jQuery click function not triggered when unchecking checkbox -


this doing head in, have googled life out of it, below code, simple, not click event triggered when unchecking checkbox??

$('#filterstardiv #hotelfilterform #star0').click( function() { alert('checkbox 0 clicked');});  <div id="starsremoved" style="display:none">no stars removed</div> <div id="filterstardiv"> <h6>click on star ratings below add or remove hotels in category</h6> <form:form id="hotelfilterform" action="" acceptcharset="utf-8">     <input type="checkbox" id="star0"  name="star0" value="0 star" checked="checked" /> 0 star<br />     <input type="checkbox" id="star1"  name="star1" value="1 star" checked="checked" /> 1 star<br />     <input type="checkbox" id="star2"  name="star2" value="2 star" checked="checked" /> 2 star<br />     <input type="checkbox" id="star3"  name="star3" value="3 star" checked="checked" /> 3 star<br />     <input type="checkbox" id="star4"  name="star4" value="4 star" checked="checked" /> 4 star<br />     <input type="checkbox" id="star5"  name="star5" value="5 star" checked="checked" /> 5 star+<br /> </form:form> </div> 

any help, abuse if missing stupid, appreciated.

you can try :

$("input[type=checkbox]").click( function() {     if ($(this).is(':checked')){         alert('check');     }     else{         alert('uncheck');     } }); 

you can try on fiddle


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -