jquery - Apply class to every 4th li inside a ul -


i need display 4 li elements in row, apply class="last" every 4th li element.

right doing this,

var licount = jquery('.explorecontentarea .listarea ul li').size(); jquery('.explorecontentarea .listarea ul li:eq(3)').addclass('last'); 

i need apply class every 4th item of ul.

please me on same.

thanks | lokesh yadav

use nth-child:

jquery('.explorecontentarea .listarea ul li:nth-child(4n)') .addclass('last').show(); 

Comments

Popular posts from this blog

mod rewrite - Doing external redirect. .htaccess NS flag not working. How to achieve similar results? -

mysql - How to insert just year and month into date field? -