Disable and enable an email field:
<!DOCTYPE html> <html> <body> E-mail: <input type="email" id="myEmail"><br><br> <button onclick="disableBtn()">Disable Email Field</button> <button onclick="enableBtn()">enable Email Field</button> <script> function disableBtn() {//from w w w.j a v a 2 s .co m document.getElementById("myEmail").disabled = true; } function enableBtn() { document.getElementById("myEmail").disabled = false; } </script> </body> </html>