Orpheus
Orpheus

Reputation: 33

jQuery selection on style attribute not working in IE

I have a html guide exported from a doc file. I'm using jquery to fix some cosmetic issues with the way word exports to html. My script is working in FF and Chrome, but not in Internet explorer.

Example of my jquery:

$("span[style='mso-tab-count:1']").html(' ');

Example of the code I use: http://jsfiddle.net/37hqLrcn/1/

Any idea what I can do to make this work across all browsers?

Upvotes: 3

Views: 474

Answers (1)

Rhumborl
Rhumborl

Reputation: 16609

Internet explorer will add a semi-colon to the end of the style attribute and also add a space after the colon, therefore your selector is not matching.

If you want to match exactly, then you will need two selectors:

$("span[style='mso-tab-count: 1 dotted;'],span[style='mso-tab-count:1 dotted']").html('  ');

There is an updated fiddle here showing it working. IE is being a PITA with iframe security tho, so you can see the result directly here

Upvotes: 2

Related Questions