Javascript examples for DOM HTML Element:Form Event
Dynamically display length as type in Javascript
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from ww w . j a v a2 s .c o m*/ var input = document.querySelector('input'); var p = document.querySelector('p'); var i = 0; input.addEventListener('keyup', function() { p.innerHTML = input.value.length; }) } </script> </head> <body> <input> <p>The length of the value</p> </body> </html>