JQuery style attribute selection not working in IE
I have a html manual exported from a doc file. I am using jquery to fix some cosmetic issues using the way to export words to html. My script works in FF and Chrome, but not Internet Explorer.
My jquery example:
$("span[style='mso-tab-count:1']").html(' ');
Example of used code: http://jsfiddle.net/37hqLrcn/1/
Any idea what I can do to make this work in all browsers?
+3
source to share
1 answer
Internet explorer will add a half-line to the end of the attribute style
and also add a space after the colon, so your selector won't match.
If you want to match exactly, you need two selectors:
$("span[style='mso-tab-count: 1 dotted;'],span[style='mso-tab-count:1 dotted']").html(' ');
Here is an updated script showing that it works. IE is a PITA with iframe safety, so you can see the result directly here
+2
source to share