[英]I can not replace the text in a html body that comes from the database
我想用来自数据库的p
标签替换文本'$$$_img1_$$$'
$("body").children().each(function() {
$(this).html($(this).html().replace('$$$_img1_$$$', variable_name));
});
$("body").children().each(function() {
$(this).html($(this).html().replace('$$$_img1_$$$', "hahahhah"));
});
如果variable_name
包含img
标记,则'$$$_img1_$$$'
将替换为图像标记<img src = ''>
试试这段代码:
$('body').each(function() {
var replaced = $("body").html().replace('$$$_img1_$$$','The ALL new string');
$("body").html(replaced);
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.