I have i problem with a jQuery function.
My objective is to make custom checkboxes and it works fine except in IE.
input.is(‘:checked’) keeps returning false when it should return true.
So every time i click on the checkbox it keeps returning false in IE
It works fine in Firefox and Crome.
What am I doing wrong?
Is there an issue with is(‘:checked’) in explorer?
$(function() {
$(':checkbox').checkbox();
});
(function($) {
jQuery.fn.checkbox = function(){
$(this).each(function(){
var input = $(this);
var label = $('label[for='+input.attr('id')+']');
label.click(function(){
if (input.is(':checked')) {
label.removeClass('checked');
}
else {
label.addClass('checked');
}
alert(input.attr('id').is(':checked'));
})
});
};
})(jQuery);