Limit number of Characters in Div with jQuery or CSS

A quick snippet for you to limit the number of characters in a span / div etc by a particular value. This function also includes a slightly neater … at the cutoff point:- <script type=”text/javascript”> $(function(){ $(“.your-div”).each(function(i){ len=$(this).text().length; if(len>80) { $(this).text($(this).text().substr(0,80)+’…’); } }); }); </script> view raw jQuery Limit number of Characters in Div hosted with ❤ by GitHub Make …