Skip to content

Instantly share code, notes, and snippets.

@glennyboy
Last active March 13, 2021 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glennyboy/82c344962311ff0b4e66c173f7f5713c to your computer and use it in GitHub Desktop.
Save glennyboy/82c344962311ff0b4e66c173f7f5713c to your computer and use it in GitHub Desktop.
jQuery Limit number of Characters in Div
<script type="text/javascript">
$(function(){
$(".your-div").each(function(i){
len=$(this).text().length;
if(len>35)
{
$(this).text($(this).text().substr(0,35)+'...');
}
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment