javascript - Check what $(this) is -
i trying alert each 1 checkbox clicked. this js code: $('#acts').find(':checkbox').click(function(){ if($(this) == 'all') { alert('checkbox clicked'); } }); and html: <div id="acts"> <input type="checkbox" id="all"> <input type="checkbox" value="brussel" name="locality"> <label>brussel</label> <input type="checkbox" value="anderlecht" name="locality"> <label>anderlecht</label> <input type="checkbox" value="oudergem" name="locality"> <label>oudergem</label> </div> i tried first way, tried adding var thename = $(this); and var thename = string($(this)); and compare in if statement agains 'thename', $(this) or variable assign to, keeps returning me [object][object], against can't compare that.