title: How to clear textbox on HTML using Javascript
body: <p>I have code in html like this</p>
  
  <pre><code>&lt;html&gt;
  &lt;script type="text/javascript" src='LatihanKuisJs.js'&gt;&lt;/script&gt;
      &lt;body&gt;
          &lt;form name="kuis"&gt;
              &lt;table border="1" width="50%"&gt;
                  &lt;tr&gt;
                      &lt;th colspan="2" &gt;Celcius
                  &lt;/tr&gt;
                  &lt;tr&gt;
                          &lt;td align="center" width="80%"&gt;Kelvin&lt;/td&gt;
                          &lt;td align="center"&gt;&lt;input type="text" id="kelvin"&gt;
                          &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td align="center" width="80%"&gt;Reamur&lt;/td&gt;
                      &lt;td align="center"&gt;&lt;input type="text" id="reamur"&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td align="center" width="80%"&gt;Fahrenheit&lt;/td&gt;
                      &lt;td align="center"&gt;&lt;input type="text" id="fahrenheit"&gt;&lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;
              &lt;input type="button" value="Calculate" onclick='calculateCelcius();'/&gt;
              &lt;br/&gt;&lt;br/&gt;
              &lt;textarea rows="20" cols="90" id="textarea"&gt;
              &lt;/textarea&gt;
              &lt;br/&gt;&lt;br/&gt;
              &lt;input type="button" value="Clear" onclick='clear();'/&gt;
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and external javascript function like this:</p>
  
  <pre><code>function calculateCelcius(){
      var kelvin = document.getElementById('kelvin');
      var reamur = document.getElementById('reamur');
      var fahrenheit = document.getElementById('fahrenheit');
      var textarea = document.getElementById('textarea');
  
      var hasil=(kelvin.value*1 + reamur.value*1 + fahrenheit.value*1);
      textarea.value += hasil + '\n';
  }
  
  function clear(){
      document.getElementById("textarea").value="";
  }
  </code></pre>
  
  <p>When I tried to click the clear button on my page, the text area wasn't clear. 
  What's wrong? And what should I do?</p>