Reputation: 10692
It seems that jQuery :contains
selector does not work on IE8.
Please see following example on IE - LIVE DEMO
JS:
$('table tr td:contains(" + ")').each( function(){
$(this).addClass('url');
});
Upvotes: 3
Views: 922
Reputation: 10692
Another simpler solution to the IE8 :contains
issue:
Make sure you are not using the space inside the string, e.g
$('table tr td:contains("+")')
will work even if your html have spaces<td> + </td>
Upvotes: 0
Reputation: 19081
You need to convert the spaces in your TDs to HTML entities (
)
for $('table tr td:contains(" + ")')
to work. (Same JS/CSS)
HTML:
<table>
<tr>
<td> + </td>
<td> 1 </td>
<td> 3 </td>
<td> 6 </td>
<td> 7 </td>
</tr>
</table>
However it will fail on modern browsers, so the solution is to replace the entities for those browsers. Just prepend this snippet before yours, it will do the job.
if( !($.browser.msie && $.browser.version < 10) ){
$('table tr td').each(function(){
$(this).html( $(this).html().replace(/ /gi, ' ') );
});
}
Upvotes: 4