jquery - on load event add images to different classes -
i want add images different classes on load of images. fiddle . http://jsfiddle.net/simmi_simmi123/kxfg7/2/
<img src="http://placehold.it/10x60" /><br /> <img src="http://placehold.it/20x50" /><br /> <img src="http://placehold.it/30x40" /><br /> <img src="http://placehold.it/40x30" /><br /> <img src="http://placehold.it/50x20" /><br /> <img src="http://placehold.it/60x10" /><br /> $(function(){ $('img').addclass('brdr1'); });
in adding images brdr1
1 want add 3 images in brdr1
, remaining in brdr2
how this. in advance
add class specify images apply class
html
<img class="b1" src="http://placehold.it/10x60" /><br /> <img class="b1" src="http://placehold.it/20x50" /><br /> <img class="b1" src="http://placehold.it/30x40" /><br /> <img class="b2" src="http://placehold.it/40x30" /><br /> <img class="b2" src="http://placehold.it/50x20" /><br /> <img class="b2" src="http://placehold.it/60x10" /><br />
css
.brdr{border:1px solid red} .brdr11{border:1px solid blue}
jquery
$(function(){ $('.b1').addclass('brdr'); $('.b2').addclass('brdr1'); });
working demo http://jsfiddle.net/cse_tushar/kxfg7/5/
Comments
Post a Comment