Does anyone know how to add "disable attribute" to all elements when button is clicked?
| SitePoint Sponsor |
Does anyone know how to add "disable attribute" to all elements when button is clicked?

Hi there,
Please define "all elements".
The following snippet will disable all inputs on a page on button press (where the button has an id of "myButton")
Code JavaScript:$("#myButton").on("click", function(){ $("input").prop('disabled', true); });
How well do you know your JavaScript from your jQuery?
Check out SitePoint's latest JavaScript challenge
My blog
Bookmarks