Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery显示HTML标记不是此标记的结果吗?_Jquery_Tags - Fatal编程技术网

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而不是文本