Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.