简体   繁体   English

使HTML呈现 <!= and !> 标签

[英]Getting HTML to render <!= and !> tags

I need to use the <!= ... !> tags in my code as part of aa jQuery plugin but Chrome is displaying it as <!--= ... !--> , presumably because it thinks it's a malformed comment. 我需要在代码中使用<!= ... !>标签作为jQuery插件的一部分,但Chrome将其显示为<!--= ... !--> ,大概是因为它认为这是格式错误的注释。

Is there a way of forcing browsers to print the tags as is, allowing for the jQuery plugin to work properly? 有没有一种方法可以强制浏览器按原样打印标签,从而使jQuery插件正常工作?

Yes, there is a way of doing this and it is by using the ANSI code for them. 是的,有一种方法可以做到,那就是使用ANSI代码。 for example you can try this: 例如,您可以尝试以下操作:

&lt;!--= ... !--&gt;

The above HTML will be rendered as: 上面的HTML将呈现为:

<!--= ... !-->

Using this method, you can convert the part of the code to ANSI code, by which Browser won't confuse it with a comment and will display it. 使用此方法,您可以将部分代码转换为ANSI代码,这样浏览器就不会将其与注释混淆并显示出来。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM