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
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
$("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).
Source: https://ru.stackoverflow.com/questions/420349/
All Articles