Skip to content

Instantly share code, notes, and snippets.

@hokaccha
Created February 5, 2009 07:26
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save hokaccha/58594 to your computer and use it in GitHub Desktop.
Save hokaccha/58594 to your computer and use it in GitHub Desktop.
wordbreak.js for jQuery
$(function(){
var $targetElement = '.wordBreak';
if($.browser.msie) {
$($targetElement).css('word-break', 'break-all');
} else {
$($targetElement).each(function(){
if(navigator.userAgent.indexOf('Firefox/2') != -1) {
$(this).html($(this).text().split('').join('<wbr />'));
} else {
$(this).html($(this).text().split('').join(String.fromCharCode(8203)));
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment