this might be a bit confusing but here it goes. I have a first set of checkboxes like this:
<input type="checkbox" id="quick" value="6" />
<input type="checkbox" id="quick" value="3" />
And a second set of checkboxes like this:
<div class="check1"><input type="checkbox" id="1,3,4" value="6" /></div>
<div class="check1"><input type="checkbox" id="1" value="6" /></div>
<div class="check1"><input type="checkbox" id="6,4" value="6" /></div>
I need to get the value of the first checkbox and check in if that value exists in the id array of the second set of checkboxes and check them if it returns true. This is what I have so far but it is not working:
$('#quick').click(function(){
var perId = $(this).val();
$('#check1 input[type="checkbox"]').attr('id').find(perId).attr('checked', true);
});
Does anyone have any idea how to accomplish this?? Any help would be greatly appreciated!
I changed a few things around to make the code more sensible (please let me know if I broke anything).
data-setattributes.Fiddle: http://jsfiddle.net/u2q8P/4/