Jquery only registers one id
I have three checkboxes that looks like this:
<input id="image_tagging" class="1" type="checkbox" value="1"
checked="checked" name="data[image_tagging]">
now i wanted to create some ajax (which is working fine) however only the
first checkbox has the event:
here is my Jquery function:
$('#image_tagging').click(function(){
var value = 0;
var websiteID = $(this).attr('class');
if($(this).attr('checked')){
value = 4;
}else{
value = -4;
}
alert('works! '+'id = '+websiteID+" value = "+value );
});
So my question is. why is this click function only happening for one of my
checkboxes? (if it matters it is only the first checkbox that is working)
No comments:
Post a Comment