I have 5 text boxes whose IDs and names are all different from each other. But i have to enable all 5 text boxes when a certain checkbox is checked. How do i do this with JavaScript?
1 Answer
With jQuery you can do
<input id="check" type="checkbox" value=""><br>
<input type="text" value="" disabled="disabled"><br>
<input type="text" value="" disabled="disabled"><br>
<input type="text" value="" disabled="disabled"><br>
var $input = $('input[type="text"]');
$('#check').live('click', function() {
$(this).is(':checked') ? $input.removeAttr('disabled') : $input.attr('disabled', 'disabled');
})