html - jquery - Display only 15 list items in a UL -


I have a list that is generated by WordPress and I have no way to limit it through the function How many tags are displayed themselves

With jQuery I only want to do this to display 15:

  $ j (function () {if ($ j ('# popular-tags) Decided to 'length' gt; {var displayAmt = 15; var list = $ j (this) .find ('ul'); for (var i = 1; i & lt; = displayAmt; i ++ } {....}}});   

How do I go through each list item again, but a bit lost but I have a class named .not-display which I belong to I want to add to the list item. I was also not sure that I should use the .each () function which provides jQuery

Can someone illuminate me?

You think most of the time, a loop with JQuery is not required: < Pre> var displayAmt = 15; $ J ('# Popular-Tagged'). Piece (displayAmt) .hide ();

finds this code in the li elements in the tag

div, after using 15 elements to get access to each element , And calls to hide () if you wish, instead you can choose to call on remove .

Comments