Javascript examples for DOM HTML Element:Div
Put words from input text field value to div
<html> <head> <script language="JavaScript"> var answer_var = ''; var elem = ''; function add_answers(elem){ answer_var = elem.value+" "; document.getElementById('answer_div').innerHTML = document.getElementById('answer_div').innerHTML + answer_var; }// w w w. j a v a 2 s.c o m </script> </head> <body> <input type="text" id="answer_var" value="word" onclick="add_answers(this);"> <div id="answer_div"></div> </body> </html>