Reputation: 3384
I am using this bit of jQuery:
$('.myClass').html().replace("-", "‑");
to replace hyphens with non-breaking hyphens to prevent wrapping on text containing....you guessed it: hyphens
This works fine in IE8 and upwards but we have to support IE6 and 7, in which this approach does not work.
Any ideas?
Upvotes: 2
Views: 449
Reputation: 36742
I believe it is because IE 6-7 see a hyphen as a "word break".
The only way I can think to fix it is to wrap the phrase in <nobr></nobr>
tags.
Eg. <nobr>word-break</nobr>
which should prevent your issue.
Though without seeing some context it's hard to say how you would do this.
EDIT
This info may be helpful: http://www.cs.tut.fi/~jkorpela/html/nobr.html
Upvotes: 1