<html> <head> </head> <body> <input id="name" type='text' name='name'> <div id="name"></div> <script> a=document.querySelectorAll("#name") a[0].oninput=function(){a[1].innerHTML=this.value} </script> </body> </html>