jquery - How do I set the character limit for .load -
i'm pulling in body of text page, want limit amount of characters .load event pulls. how control amount of characters pulled class ".paragraph"?
here have far:
$("document").ready(function(){ // blog descriptions $( ".blog-description-3" ).load( "/blog.html .blog-post:nth-of-type(3) .blog-content .paragraph"); });
you can't limit number of characters method pulls in. can manipulate returned string , cut needs substr()
$(".blog-description-3").load("/blog.html .blog-post:nth-of-type(3) .blog-content .paragraph", function() { var txt = $(".blog-description-3").text().substr(0, 20); $(".blog-description-3").text(txt); });
Comments
Post a Comment