<div id="reader1" class="reader monelem_box">
<div class="monelem_sheaf" style="position: absolute; overflow: hidden;">
<div class="image">
<img class="image" alt="image" src="images/img_001.jpg">
My javascript code to replace is
$("#reader1").attr("src", function () {
return $(this).attr('src').replace("images", "sunset");
});
How can I replace this src attribute?
The problem is your selector, given your example I’d use:
This will limit it to
<img>'swhich have the classimage, and are descendants of#reader1