jQuery code works in Chrome, not in IE9
Posted
by
Francis Ducharme
on Stack Overflow
See other posts from Stack Overflow
or by Francis Ducharme
Published on 2014-06-04T15:12:27Z
Indexed on
2014/06/04
15:25 UTC
Read the original article
Hit count: 143
Pretty new to jQuery here, I've got a chunk of code that works OK in Chrome, but fails in IE9 (have not tried FF yet).
Here's the code:
var textColor = $('#navmenu-body').css('color');
textColor = textColor.slice(4);
In IE9, I get an error to the effect that slice
can't be called because textColor
is undefined.
I was not sure if it's because jQuery just can't find the #navmenu-body
element or that it can't find the CSS attribute color
.
So I did:
var j = $('#navmenu-body');
var textColor = $('#navmenu-body').css('color');
textColor = textColor.slice(4);
In IE9's console, j.length
returns 0. So the selector is indeed, not working
Here's the #navmenu-body
HTML DOM
<div id="navmenu-body" class="x-panel-body x-panel-body-cssmenu x-layout-fit x-panel-body-cssmenu" style="height: 398px; left: 0px; top: 0px; width: 200px;">
</div>
Do I need to do something else for IE9 support ?
© Stack Overflow or respective owner