Here’s a jsFiddle link:
So you can click on the checkbox, and it’ll enable the fields next to it. But if you leave one checked, then check the next (which does enable the fields), then uncheck one of them, it doesn’t do anything.
Obviously it’s because of the way I wrote my jQuery. And the checkbox, when duplicated, has the same class name. It’s checking to see if it’s checked. But I can’t figure out how to re-write it so that it only checks if THIS one I clicked is checked, not any other ones.
Any ideas?
JS:
$('table input.activate').click(function(e) {
if ($(this + ':checked').length > 0) {
$(this).parent().parent().find('input.input-mini, input.input-small, select.input-mini').attr('disabled', false);
} else {
$(this).parent().parent().find('input.input-mini, input.input-small, select.input-mini').attr('disabled', true);
}
});
This works: