I tried to create a new text input once the last text box gets focus. But I cant even type in them because every time it gets focus a new text input is created! I really dunno what to do.
how to modify so not every time a new text input created when tried to type in?
Code:
<html> <head> <script type="text/javascript"> function getTB(field) { var i = document.getElementById("f1").length + 1; var cmd = "<input type=text name = "+ i + " onfocus=getTB() value = " + i + ">"; document.getElementById('f1').innerHTML = document.getElementById('f1').innerHTML + cmd; document.getElementById(i-2).focus(); } </script> </head> <body> <form id ="f1"> <input type ="text" value ="hello" name="1" onFocus ="getTB(this)"> </form> </body> </html>
Comment