javascript - Wrap text in td without breaking the word -
i have issue in word wrapping in css. have td have defined width 300px. have url inside td
http://www.abc.com/testing/testdata/testurl/test/testing.html when use word-wrap: break-word, text wrapping
http://www.abc.com/testing/testdata/tes turl/test/testing.html but want word break. /tes in 1 line , turl in line. want as,
http://www.abc.com/testing/testdata/testurl/ test/testing.html kindly help. appreciated. thanks.
updated:
i have probability of getting text other url. means can't relay on '/' in data. can use javascript not jquery.
i can't think of css-only solution. using javascript add word break opportunity tag <wbr>. tells browser - except internet explorer - can insert breaks:
javascript (using jquery)
$('#element').html( $('#element').html().replace(/\//g, '/<wbr>') ); demo
as of edit
you edited question while writing fiddle. can of course use character / used in expression replaced <wbr>-tag.
Comments
Post a Comment