Javascript examples for DOM HTML Element:Input Text
Replace input text value by text in a string
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> function edValueKey(e)/*from www . j av a2s. c o m*/ { var monTexte = 'This is my test'; var my = document.getElementById("edValue").value; my = my.length + 1; document.getElementById("edValue").value = monTexte.substr(0, my); e.preventDefault(); } </script> </head> <body> <input id="edValue" type="text" onKeyPress="edValueKey(event)"> </body> </html>