Add text to a textbox by clicking a button - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Button

Description

Add text to a textbox by clicking a button

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script>
function ButtonClick_Test()// www  . j  a  v  a 2s  .  c  om
{
    document.getElementById("result").value= ' your text here';
}

      </script> 
   </head> 
   <body> 
      <form>
          Click Here:
         <br> 
         <input type="button" value="Click Here" name="no" onclick="ButtonClick_Test()"> 
         <input type="text" id="result" size="20"> 
      </form>  
   </body>
</html>

Related Tutorials