Here is a list with checkboxes:
<ul class="cate_select_ul">
<li>
<!-- outer checkbox A -->
<label><input value="251" type="checkbox" name="post_category[]">Automobiles & Transport</label>
<ul class="children">
<li>
<!-- inner checkbox A -->
<label><input value="252" type="checkbox" name="post_category[]">Car Parts</label>
</li>
</ul>
</li>
<li>
<!-- outer checkbox B -->
<label><input value="251" type="checkbox" name="post_category[]">Automobiles & Transport</label>
<ul class="children">
<li>
<!-- inner checkbox B -->
<label><input value="252" type="checkbox" name="post_category[]">Car Parts</label>
</li>
</ul>
</li>
</ul>
I am looking to determine if the inner checkbox is checked, and if so, change the style of the label around the parent outer checkbox. I attempted the following code but it's not working correctly:
if($('ul.children input[name="post_category[]"]:checked').length > 0){
$("this").parent().parent().parent().parent().children("label").css({"color":"red"});
}
Any suggestions on how to achieve this desired effect?