Jquery显示HTML标记不是此标记的结果吗?
为什么在这个脚本之后:Jquery显示HTML标记不是此标记的结果吗?,jquery,tags,Jquery,Tags,为什么在这个脚本之后: $("<span />", { text: this.value+' <br /><br />', "class":"view" }).insertAfter(this); $(“”,{text:this.value+',“类”:“视图”}).insertAfter(this); 我看到文本。我想查看结果,而不是HTML标记。 请提供任何帮助使用html $("<span />", { html: this.value+
$("<span />", { text: this.value+' <br /><br />', "class":"view" }).insertAfter(this);
$(“”,{text:this.value+'
,“类”:“视图”}).insertAfter(this);
我看到文本
。我想查看结果,而不是HTML标记。请提供任何帮助使用html
$("<span />", { html: this.value+' <br /><br />', "class":"view" }).insertAfter(this);
//^
$(“”,{html:this.value+'
,“类”:“视图”}).insertAfter(this);
//^
阅读
将您的值替换为:
html: this.value + ' <br /><br />', "class": "view"
html:this.value+'
,“类”:“视图”
为什么?
因为您正在更新元素的可见值文本
使用html
您将在其旁边写入值,作为html内容。而
将用作换行符。使用html而不是文本