Last active
March 13, 2021 19:25
-
-
Save glennyboy/82c344962311ff0b4e66c173f7f5713c to your computer and use it in GitHub Desktop.
jQuery Limit number of Characters in Div
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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