How to disable and enable HTML form fields using JavaScript

H

How Can We Help?

How to disable and enable HTML form fields using JavaScript

To enable a form field use the below JavaScript

document.getElementById("ELEMENT_ID").disabled = false;

And to disable the form field use the below JavaScript

document.getElementById("ELEMENT_ID").disabled = true;

NOTE: Replace ELEMENT_ID with the form fields ID

About the author

Ian Carnaghan

I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment.

About Author

Ian Carnaghan

I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment.

Follow Me