I want to replace the text '$$$_img1_$$$'
with a p
tag that will come from the database
$("body").children().each(function() {
$(this).html($(this).html().replace('$$$_img1_$$$', variable_name));
});
$("body").children().each(function() {
$(this).html($(this).html().replace('$$$_img1_$$$', "hahahhah"));
});
If the variable_name
contains a img
tag then the '$$$_img1_$$$'
will be replaced with the image tag <img src = ''>
Try this code:
$('body').each(function() {
var replaced = $("body").html().replace('$$$_img1_$$$','The ALL new string');
$("body").html(replaced);
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.