jquery - Add Last Child Elements of <div> in some Class -


my <div> contains 10 images. want add class last 3 images. how it?

$(document).ready(function ()  {     $('img').addclass('t2');     $('#myimageflow img').slice(12, 16).addclass('t1');     $("div img:first-child").removeclass('t2'); } 

i tried not working.

my contains 10 images. want add last 3 images class....

then why use slice(12, 16)?! use slice(-3)

$('#myimageflow img').slice(-3).addclass('t1'); 

demo


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -