我试图在将鼠标悬停在图像上时显示 Bootstrap 工具提示。我在该工具提示中有一段文字需要将其设为粗体。
我从提到的来源尝试过这个,但对我没有用..
<button class="infoTipsBox" type ="button" data-toggle="tooltip" data-placement="right"data-original-title='<b>big tooltip</b>'>
</button>
Js:
$(function () {
$('[data-toggle="tooltip"]').tooltip();
});
我做错了什么??
在 title
属性的上述文本中,我试图将“bootstrap tooltip”设为粗体,其余部分设为普通字体。我怎样才能做到这一点?
最佳答案
正如您在 Bootstrap' official documnetation for tooltip 中看到的那样
Name | Type | default | Description
----------------------------------------------------------------------------
html | boolean | false | Insert html into the tooltip.
If false, jquery's text method
will be used to insert content
into the dom. Use text if you're
worried about XSS attacks.
因此,将 data-html="true"
添加到您的工具提示中,这将在您的工具提示中启用 HTML
关于jquery - 如何在 bootstrap 工具提示 CSS/Jquery 中提到的文本中使单词变为粗体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31041858/