Javascript examples for DOM HTML Element:Form Event
Submit Button enable and disable by input field length value
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/* ww w.j av a 2s . c o m*/ var btn=document.getElementById("btn"); var phone=document.getElementById("phone"); phone.onkeyup=function(){ btn.disabled=!(phone.value.length===10); }; } </script> </head> <body> <input id="phone" type="text"> <button id="btn" disabled>Send</button> </body> </html>