我有一个转义的HTML字符串,当jQuery选择该字符串时,它会转义带有运行脚本漏洞的转义字符串。看到这个jsfiddle https://jsfiddle.net/x751u2gq/2/
<div id="banner-message">
<button>Inject Alert Message</button>
<span id="myspan"
name="</script><script>alert(String.fromCharCode(84, 11,
107, 101, 110, 46))</script>"></span>
</div>
button.on("click", function(){
banner.addClass("alt");
span = $("#myspan").attr("name");
$("#myspan").html(span);
})
如何让jQuery按原样选择字符串,例如“ “