is the jQuery function "change()" working in IE ?
I usually use it to detect changes in forms (select/unselect check boxes), and submit them automatically without having to click on submit button (which is hided).
i.e.
$("#views-exposed-form-Portfolio-page-1").change(function(){
$("#views-exposed-form-Portfolio-page-1").submit();
});
But in Ie it doesn't work. It seems I have to use "click" instead. 开发者_如何学编程thanks
Solution in IE:
if (navigator.appName == 'Microsoft Internet Explorer') {
$(".option").click(function(){
$("#loadingOverlay").css('display','block');
if ($(this).children().is(':checked')) {
$(this).children().attr('checked', '');
} else {
$(this).children().attr('checked', 'checked');
}
$("#views-exposed-form-Portfolio-page-1").submit();
});
}
In IE, change() doesn't work.. so I used the following code:
if ($(this).children().is(':checked')) {
$(this).children().attr('checked', '');
} else {
$(this).children().attr('checked', 'checked');
}
$("#views-exposed-form-Portfolio-page-1").submit();
});
See my answer here: IE not detecting jquery change method for checkbox
The change
event will only be fired when the element loses focus (blurs). Click once again somewhere on the page so that your checkbox/radiobutton blurs, then you'll see that it get fired. In case of checkboxes and radiobuttons you'd indeed rather like to hook on click
event. It also makes sense, clicking it will (un)check the checkbox/radiobutton anyway :)
This "problem" is not specifically related to IE.
It seems Jquery change function works in IE-7 now. 'Change' can be used with select(drop down), check box and radio buttons.
精彩评论