I want to add a class to my label of my checkbox if it's checked.
Heres my html
<ul class="checkbox-list">
<li><label class="rounded-all">Google <input class="checkbox-row" name="google" type="checkbox" value=""></label></li>
<li><label class="rounded-all">Bing <input class="checkbox-row" name="bing" type="checkbox" value=""></label></li>
<li><label class="rounded-all">Facebook <input class="checkbox-row" name="facebook" type="checkbox" value=""></label> </li>
</ul>
I tried with this piece of code i got off here but doesn't seem too do the trick:
$(".checkbox-row").change(function() {
$(this).closest('.checkbox-list li label').toggleClass("selected", this.checked);
});