开发者

Whether jQuery can according to article words, automatically add a toggle function?

I have many articles. Article structure as follows

<p> ___some word___ </p>
<p> ___some word___ </p>
<p> ___some word___ </p>
<p> ___some word___ </p>
...

Whether jQuery can according to article words, automatical开发者_如何学JAVAly add a toggle function?

I need: show first 100 words and toggle the rests OR show the first 3 <p></p> and toggle the rests.

Thanks.


$('p:contains("some word")').toggle(function(){
  //do something
});

More info on the :contains selector at http://api.jquery.com/contains-selector/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜