且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将纯文本转换为HTML

更新时间:2023-02-03 08:24:48

您需要先保留原始响应才能执行此操作...

You would need to hold onto the original response to do this...

$("#hiddendiv").html(data);
$("#div").text(data);

然后您可以将其取回...

Then you could get it back out...

var html = $("#hiddendiv").html();

根据评论进行更新...

您可以在显示该元素之前将其删除...

You can remove that element before you display it...

var html = $(data);
$('#cookiediv', html).hide();
$('#div').html(html);

cookie消息中包含id="cookiediv"的位置-您可能需要调整选择器才能进入此div,但几乎可以肯定会抓住它.

Where the cookie message has id="cookiediv" - you may need to adjust the selector to get to this div, but it is almost certainly possible to grab it.