How to enable/disable input in javascript?
Disable input in javascript:
// find input element
let txtName = document.getElementById("txtName");
// disable input element
txtName.disabled = true;
Enable input in javascript:
// find input element
let txtName = document.getElementById("txtName");
// enable input element
txtName.disabled = false;
Javascript Demo: https://jsbin.com/hokusaqola/edit?html,output
-
CreatedJan 16, 2020
-
UpdatedNov 03, 2020
-
Views1,392
Related Articles
Check/Uncheck checkboxes when parent checkbox is checked/unchecked and vice-versa in Java Script
Set DropDownList value based on text/value in Java Script
Get selected text/value from DropDownList (or) Select in Java Script
Get selected index from DropDownList (or) Select in Java Script
How to validate number in Java Script
How to add or remove rows dynamically to HTML Table in Java Script
How to create HTML Table dynamically in Java Script
How to get or set value of a textbox in Java Script
How to get Key Codes in Java Script
How to replace string in Java Script?