I want to disable my all input element of a div by applying my custom css class. but i could not find any css attribute which can disable an input element. currently what am i doing
$('#div_sercvice_detail :input').attr('disabled', true);
$('#retention_interval_div :input').addClass("disabled");
which can disable all input element of div with css attr but i want to apply my custom class for disable all input with some extra css attributes
$('#retention_interval_div :input').addClass("disabled");
class
.disabled{
color : darkGray;
font-style: italic;
/*property for disable input element like*/
/*disabled:true; */
}
any suggestion for doing this with jquery without using .attr('disabled', true);?
.prop('disabled',true)
is how you should do it with the current version of jQuery - which meets your request for a way to avoid the.attr()
method. – nnnnnn Aug 8 '12 at 11:26disabled
. jQuery's.prop()
is the better method. Though I'm assuming you want to avoid that as well asattr()
. May I ask why? – David Thomas Aug 8 '12 at 11:29