For my needs I use
$('#form :input').each( function(i) { if ( !$(this).hasClass('donot') ) { $(this).attr('disabled', 'disabled'); } });
is there a better way not to use the if condition to check if the input has the class "donot"?
Thank you for your help...
Chris
$('#form input:not(.donot)').each( function(i) { $(this).attr('disabled', 'disabled'); });
And here you are: -D
Documents for the selector :not()
:not()
Or you can also do:
$('#form input').not('.donot').each( function(i) { $(this).attr('disabled', 'disabled'); });
Documents for .not()
.not()
Try this and you donβt even need every cycle to do this.
$('#form input:not(.donot)').attr('disabled', 'disabled');