How to disable and enable HTML form fields using JavaScript

No Comments

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

Image Credits: Photo by Isis França on Unsplash.

Related Articles

No results found

Leave a Reply

avatar
  Subscribe  
Notify of
Menu
Copy link