views:

102

answers:

3

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();     
    }); 
}
A: 

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();     
}); 
Patrick
A: 

See my answer here: IE not detecting jquery change method for checkbox

kflorence
A: 

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.

BalusC