Jquery recursive selector

Posted by Mazzi on Stack Overflow See other posts from Stack Overflow or by Mazzi
Published on 2010-03-17T06:58:23Z Indexed on 2010/03/17 7:01 UTC
Read the original article Hit count: 303

Filed under:
|
|

Hi There,

I have whole bunch of <div class="productlistname"><a href="#">The Text!</a></div>. What I want to do go through all .productlistname and truncate the text and replace the current text with the truncated version.

Here is what I have so far:

$(".productlistname a").html($(".productlistname a").html().substring(0,10));

This just truncate the first one and replaces the rest of .productlistname with the truncated version of the first one.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about truncate