using jquery, how can i select all images inside of a div to change its source -
i have following div , know selector id of div.
<div class="event"> <img src="/content/images/icons/calendar1.png"> <img src="/content/images/icons/calendar2.png"> <img src="/content/images/icons/calendar3.png"> <img src="/content/images/icons/calendar4.png"> <img src="/content/images/icons/calendar5.png"> <img src="/content/images/icons/calendar6.png"> </div>
i need find images selector inside div have can go change source of each image new image.
use code retrieve image url:
$('.event img').each(function(){ alert($(this).attr('src')); });
if want change image url use this:
var inc = 1; $('.event img').each(function(){ $(this).attr('src','path of image/imagename'+inc+'.imageextension'); inc++; });
Comments
Post a Comment