javascript - how to break the long word in html? -


i'm creating list dynamically in javascript. want break long word in dot dot dot(.....). example, if word "software life cycle development" want change "software life cycl....".

and used "word-break:break-all;white-space:normal;" current output is:

software life cycle development.

can tell, how fix this? in advance.

  var parent = document.getelementbyid('searchlistview'); var listitem = document.createelement('li'); listitem.setattribute('id', 'listitem_' + listid); listitem.setattribute('data-icon', 'false'); listitem.innerhtml = "<img src=" + imagesrc + " class='ui-li-icon ui-li-has-icon'></img> <a target='_black' data-role='button' href='#' id=" + listid + " name= " + url + " data-theme ='c' rel='external'  data-inline='true' style='margin-left:0em; word-break:break-all;white-space:normal; ' >" + searchname + "<p style='margin-top:1px;margin-left:1px;'> file size: " + filesize + "</p></a>"; parent.appendchild(listitem); 

you can try css

text-overflow:ellipsis; 

it put ... when text overflow. see page reference.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -