I found this code when surfing through jquery tooltip. Please Suggest why we use certain code and what does it mean?
我在浏览jquery工具提示时发现了这段代码。请建议我们为什么使用某些代码,这是什么意思?
<pre class="prettyprint">
<head>
<script>
$(document).ready(function() {
$('.tooltip').tooltipster({
contentAsHTML: true
});
});
</script>
</head>
<body>
<div class="tooltip" title="&lt;img src=&quot;my- image.png&quot; /&gt; &lt;strong&gt; This text is in bold case !&lt;/strong&gt;">
This div has a tooltip with HTML when you hover over it!
</div>
</body></pre>
5 个解决方案
#1
The code that your entered is html encoded, it means that with html special characters:
您输入的代码是html编码的,这意味着使用html特殊字符:
<script>
$(document).ready(function() {
$('.tooltip').tooltipster({
contentAsHTML: true
});
});
</script>
</head>
<body>
<div class="tooltip" title="<img src=my-image.png /> <strong> This text is in bold case!</strong>">
This div has a tooltip with HTML when you hover over it!
</div>
</body></pre>
ISO-8859-1 is the default character in HTML 4.01, please see the list of XML and HTML character for more information.
ISO-8859-1是HTML 4.01中的默认字符,请参阅XML和HTML字符列表以获取更多信息。
For instance, "<" is "<" (less-than sign, U+003C)
例如,“<”是“<”(小于号,U + 003C)
The code you tried to understand creates tooltip when user put mouse on the div with the text
当用户将鼠标放在包含文本的div上时,您尝试理解的代码会创建工具提示
This div has a tooltip with HTML when you hover over it!
当你将鼠标悬停在它上面时,这个div有一个带有HTML的工具提示!
The content of the toolpit is between the title tag, so
toolpit的内容位于title标签之间,所以
<img src=my-image.png /> <strong> This text is in bold case!</strong>
此文字以粗体显示!
img is to show a picture ant the text between strong... is strong :-)
img是显示图片蚂蚁之间强烈的文字...很强:-)
#2
They are HTML entities, used to show symbols on the page, such as those that are actual html code. So < >
as an HTML entity is < >
(less than, greater than). ©
is the copyright symbol etc
它们是HTML实体,用于在页面上显示符号,例如那些是实际的html代码。所以作为HTML实体的<>是< > (小于,大于)。 &复制;是版权符号等
#3
#4
Please refer to this resource for a better understanding http://w3schools.com/HTML/html_entities.asp
请参阅此资源以更好地理解http://w3schools.com/HTML/html_entities.asp
#5
Those are html entities. Reserved characters in HTML
must be replaced with character entities. Characters, not present on your keyboard, can also be replaced by entities.
那些是html实体。 HTML中的保留字符必须替换为字符实体。键盘上没有的字符也可以由实体替换。
#1
The code that your entered is html encoded, it means that with html special characters:
您输入的代码是html编码的,这意味着使用html特殊字符:
<script>
$(document).ready(function() {
$('.tooltip').tooltipster({
contentAsHTML: true
});
});
</script>
</head>
<body>
<div class="tooltip" title="<img src=my-image.png /> <strong> This text is in bold case!</strong>">
This div has a tooltip with HTML when you hover over it!
</div>
</body></pre>
ISO-8859-1 is the default character in HTML 4.01, please see the list of XML and HTML character for more information.
ISO-8859-1是HTML 4.01中的默认字符,请参阅XML和HTML字符列表以获取更多信息。
For instance, "<" is "<" (less-than sign, U+003C)
例如,“<”是“<”(小于号,U + 003C)
The code you tried to understand creates tooltip when user put mouse on the div with the text
当用户将鼠标放在包含文本的div上时,您尝试理解的代码会创建工具提示
This div has a tooltip with HTML when you hover over it!
当你将鼠标悬停在它上面时,这个div有一个带有HTML的工具提示!
The content of the toolpit is between the title tag, so
toolpit的内容位于title标签之间,所以
<img src=my-image.png /> <strong> This text is in bold case!</strong>
此文字以粗体显示!
img is to show a picture ant the text between strong... is strong :-)
img是显示图片蚂蚁之间强烈的文字...很强:-)
#2
They are HTML entities, used to show symbols on the page, such as those that are actual html code. So < >
as an HTML entity is < >
(less than, greater than). ©
is the copyright symbol etc
它们是HTML实体,用于在页面上显示符号,例如那些是实际的html代码。所以作为HTML实体的<>是< > (小于,大于)。 &复制;是版权符号等
#3
<
is used for the < symbol. Similary >
is used for the > symbol. These are known as HTML entities.
<用于 <符号。相似>用于> 符号。这些被称为HTML实体。
On a side note you can refer this for future reference.
在旁注中,您可以参考此信息以供将来参考。
#4
Please refer to this resource for a better understanding http://w3schools.com/HTML/html_entities.asp
请参阅此资源以更好地理解http://w3schools.com/HTML/html_entities.asp
#5
Those are html entities. Reserved characters in HTML
must be replaced with character entities. Characters, not present on your keyboard, can also be replaced by entities.
那些是html实体。 HTML中的保留字符必须替换为字符实体。键盘上没有的字符也可以由实体替换。