JS:
$(document).ready(function() {
var block = false;
if $('#password').attr('disabled'); {
block = false;
}else{
block = true;
};
if block {
$('.form_input input').attr('disabled','disabled');
}else{
$('.form_input input').removeAttribute('disabled');
}
});
HTML:
<form>
<input id="password" value="" />
<input class="form_input" id="Special" />
<input class="form_input" id="Nothing Special" />
</form>
The goal is that all the inputs with a certain class get the attribute disabled if the first input with ID=”password” does NOT have the attribute disabled. If the first input is disabled, nothing happens. I.e. the other inputs won’t get the disabled attribute.
Like this? jsFiddle example
Or the ultra-condensed version:
jsFiddle example