html - How to limit length of inner divs inside another div using jquery -


like

    <div class="a">     <div class="a1"></div>     <div class="a2"></div>     <div class="a3"></div>     <div class="a4"></div>     <div class="a5"></div>     <div class="a6"></div>     <div class="a7"></div>     <div class="a8"></div>     </div> 

i need limit length of div 'a' 4 using jquery. in advance

try remove them all:

$(".a4").nextall().remove(); 

jsfiddle: http://jsfiddle.net/myc4a/1/

or even:

$(".a > *:eq(3)").nextall().remove(); 

http://jsfiddle.net/myc4a/2/


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -