Reputation: 41
I'm looking for a way to change the div background color which is the parent of a checkbox. However I only want it to change background color when the attribute 'checked' is inside the tag.
HTML
<div class="company">
<input type="checkbox" name="Selected[]" class="checkboxC" value="8" checked>
Company 8
</div>
<div class="company">
<input type="checkbox" name="Selected[]" class="checkboxC" value="9">
Company 9
</div>
So in the example above, I'd only want the div with checkbox 8 to change background color. 9 Stays the default color. I also can't do anything with the name attribute because that's taken by PHP. Any help on how I can fix this using Javascript/jQuery?
Upvotes: 0
Views: 2345