SaurabhLP
SaurabhLP

Reputation: 3657

Jquery's Multiple Selector not working in IE

I Have developed this code for making same height of the divs as same as a specific div but its not working in IE9 and below. I dont know the mistake i am doing...

The demo:- http://jsfiddle.net/ZWkm5/

JS:-

$(window).load(function() {

    var getWrapHeight = $('#wrap').height();
    console.log(getWrapHeight);
    $(".a1, .a2, .a3, .a4").css({
        "height" : getWrapHeight,
    });

});

Upvotes: 2

Views: 231

Answers (1)

Mathew Thompson
Mathew Thompson

Reputation: 56429

console.log actually throws a JavaScript error in IE because it doesn't exist.

If you had turned on the setting "Display a notification about every script error" in IE, you'd get (this is what I got, I have it turned on):

Error: 'console' is undefined.

Remove that and it works.

DEMO: http://jsfiddle.net/ZWkm5/1/

If you REALLY want to keep that log in there, you could replace it with:

if (window.console){
    console.log(getWrapHeight);
}

Upvotes: 1

Related Questions