Home JQuery How to disable all html form elements within a DIV tag using JQuery?
 
 
 

How to disable all html form elements within a DIV tag using JQuery?

PDF Print E-mail

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
+/-
+/- Write comment
Your Contact Details:
Comment:
[b] [i] [u] [url] [quote] [code] [img]   
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):s
:!::?::idea::arrow:
Security Please input the anti-spam code that you can read in the image.
 
 
Banner