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

Javascript line number mapping -

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -