<script type="text/javascript">
$(document).ready(function(){
function htmlEncode(value){
//create a in-memory div, set it's inner text(which jQuery automatically encodes)
//then grab the encoded contents back out. The div never exists on the page.
return $('<div/>').text(value).html();
}
function htmlDecode(value){
return $('<div/>').html(value).text();
}
$("div#content").html(htmlDecode("<{$theart[theart].content}>"));
console.log(htmlDecode("<{$theart[theart].content}>"));
// $("#content").html("<p>test</p>");
});
</script>
Jquery html encode & decode
最新推荐文章于 2022-03-16 11:43:42 发布