javascript - Why is all my checkbox working except one? -
i'm trying build clausure using checkbox, got 4 checkbox working , 1 not working, don't why 1 isn't working since code works 4...
here's code
html
<input type="checkbox" id="c1" name="cc" class="cc" value="0" /><label for="c1"><span></span></label> <input type="checkbox" id="c2" name="cc" class="cc" value="1" /><label for="c2"><span></span></label> <input type="checkbox" id="c3" name="cc" class="cc" value="2" /><label for="c3"><span></span></label> <input type="checkbox" id="c4" name="ll" class="ll" value="1" /><label for="c4"><span></span></label> <input type="checkbox" id="c5" name="ll" calss="ll" value="0" /><label for="c5"><span></span></label> jquery
$(document).ready(function(){ $('.cc').change(function() { if($(this).is(":checked")) { alert($(this).val()); query = '?filter=type=' + $(this).val(); filter(); return; } query = ''; filter(); }); $('.ll').change(function() { if($(this).is(":checked")) { alert($(this).val()); query = '?filter=local=' + $(this).val(); filter(); return; } query = ''; filter(); }); }); somebody please me... checkbox working using method except checkbox c5... checkbox looks never trigged... i'm tried put alert() when check alert never work, looks c5 never trigger... i'm trying pass arguments sql query when checkbox changed...
thanks in advance!
you got typo! fifth checkbox has calss-attribute instead of class.
Comments
Post a Comment