How to disable all html form elements within a DIV tag using JQuery?
|
|
|
|
|
Question: How to disable all html form elements within a DIV tag using JQuery? Answer: To disable all input elements within div use the following code: $('#message :input').attr('disabled', true); To disable all select elements within div use the following code: $('#message :select').attr('disabled', true); To disable all submit buttons within div use the following code: $("#message :submit").attr("disabled", "true"); Explanation: - The DIV tags ID is message   Â
- attr- Access a property on the first matched element.
- $("selector")
- If disabled is set to false the element won't be disabled
|