Fseee
Fseee

Reputation: 2631

jquery selector ie8 issue

I've the following statement in jquery which perfectly works on Chrome v.22 and Firefox v.16 but doesn't work on IE8; here's the statement:

first method:

$("div[aria-labelledby='myOwnAriaLabelledBy']").css('height',450);

second method:

$("div[aria-labelledby='myOwnAriaLabelledBy']").attr('id','test');
$("#test").css('height',450);

Here's the html, I can't include classes:

<div style="display: block; z-index: 1006; outline: 0px none; 
position: absolute; height: 490.333px; width: 600.333px; 
top: 10px; left: 10px;" 
tabindex="-1" role="dialog" aria-labelledby="myOwnAriaLabelledBy">

Does anyone knows if this kind of selector has known issues with IE8? Thanks

Upvotes: 0

Views: 768

Answers (1)

foamcow
foamcow

Reputation: 479

Is your page rendering in compatibility or quirks mode?

I'm not 100% certain but I have a recollection of IE8 support for aria attributes varying depending on the render mode.

Try using a camelCase selector such as

$("div[ariaLabelledBy='myOwnAriaLabelledBy']").css('height',450);

This might only be an issue for vanilla Javascript but it could also be something that is causing jQuery to trip up. I think it's something to do with the '-' character being interpreted as a minus sign.

Upvotes: 1

Related Questions