1👍
You actually don’t need javascript. You can use text-overflow: ellipsis
along with overflow: hidden
on any block level element with a width set. It will truncate any text that won’t fit within the width and add … For example:
.dropdown-menu li a {
display: block;
width: 150px;/* this can be any width you want */
text-overflow: ellipsis;
overflow: hidden;
}
Source:stackexchange.com