Javascript examples for DOM HTML Element:Input Text
change tag innerHTML based on input and length
<html> <head> <script> function myFunction(elem) {/*from w ww. ja v a2 s .c om*/ var val = elem.value; var size = val.length; document.getElementById("ef1").innerHTML = size>0 ? val : "Default_Text"; } </script> </head> <body> <form action="#"> <fieldset> <legend id="ef1">Default_Text</legend> <input type="text" id="inputdatahere" oninput="myFunction(this)"> </fieldset> </form> </body> </html>