Tell me how to find and replace the text in the whole document? for example

<div > qweqwe</div> <img scr="img/qweqwe.jpg" > 

Change qweqwe to asdf

    1 answer 1

     $("span, p, div").each(function() { var text = $(this).text(); text = text.replace("qweqwe", "asdf"); $(this).text(text); }); 

    We pass through all the span , p and div and change the text in them.

    Attributes, of course, do not touch. Therefore, in img , your file name will remain the same (I hope you don’t need to rename attributes and tags as well).

    • Okay, the example in the question is very simple (probably even degenerate), but what if the pictures are inside divs and paragraphs? - Athari