Javascript examples for Language Basics:HTML
Use JavaScript variable in html
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <input type="text" id="userInput"> <input type="button" id="button" onclick="loader();" value="do"> <div id="placeholder"> test//from www . jav a 2 s . c o m </div> <script> function loader() { var my = document.getElementById("userInput").value; document.getElementById("placeholder").innerHTML=my; } </script> </body> </html>