I am trying to add a class when a checkbox is “checked” in Safari and remove it when it is unchecked [in other browsers I am using.bind(“focus”, function() { but in Safari it doesnt work?]
I am currently using
jQuery('.top_class input').bind("focus", function(){
jQuery(this).parents('.row').addClass("add_over");
})
.bind("blur", function() {
jQuery(this).parents('.row').removeClass("add_over");
});
This doesnt work in Safari – how to get the code to work in safari ?
If you are working with a traditional
input[type=checkbox]then I think you are looking for the click event, something like this:To be clear, this will work if this is your checkbox HTML (more or less):
UPDATE: Safari may or may not accept
focuson a checkbox depending on settings. Since there is no way to test this, I would handle it this way:That should do what you want. You can see a DEMO of it working in Safari here: http://jsbin.com/ohuxe/