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

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -