tags:

views:

162

answers:

2
$('#PbtnSubmit').click(function() {
    if ($("#PricingEditExceptions input:checkbox:checked").length > 0) {
        var chec = $('#PricingEditExceptions input[type=checkbox]:checked');
        var PMstrIDs = chec.map(function() {
             return $(this).val();
        }).get().join(",");
        alert(PMstrIDs);
        $('#1_exceptiontypes').attr('value', exceptiontypes)
        $('#1_PMstrIDs').attr('value', PMstrIDs);
    } else {
        alert("please select atleast one exception");
        return false;
    }
});

 var checked = $('#PricingEditExceptions input[type=checkbox]:checked'); 

This code returns correct value in Firefox but not in IE8. Is there something I need to change?

Why I am not getting all the checked checkboxes in IE8?

please can anybody help me out?

+10  A: 

Your "if" statement it's not closed... for IE, that's punishable by death :)

Zuul
sorry I dint send my al code..
please see my update..
+3  A: 

Zuul's answer is probably the correct answer. But I'd also like to point out there's another difference between IE and other browsers. If this code is called from a change() event handler, you could see unexpected behavior. There's a difference between IE and other browser in the way checkbox change events are handled.

You should always bind the click() event instead of the change() event.

Philippe Leybaert
@Philippe Leybaert, pertinent aspect, that you point out! (I was not thinking on that prism)... One Up vote for your broad view of the problem ;)
Zuul