Twitter bootstrap Bootstrap 4 html工具提示正在删除内联样式
我正在使用以下代码初始化工具提示:Twitter bootstrap Bootstrap 4 html工具提示正在删除内联样式,twitter-bootstrap,bootstrap-4,tooltip,popper.js,Twitter Bootstrap,Bootstrap 4,Tooltip,Popper.js,我正在使用以下代码初始化工具提示: $('.tooltip').each(function () { $(this).tooltip({ html: true, title: $('#' + $(this).data('tip')).html() }); }); 工具提示代码示例: <div class="tooltip"> <div class="inner"> <div class="tooltip__conten
$('.tooltip').each(function () {
$(this).tooltip({
html: true,
title: $('#' + $(this).data('tip')).html()
});
});
工具提示代码示例:
<div class="tooltip">
<div class="inner">
<div class="tooltip__content">
<ul>
<li>
<div class="rating">
<div class="level" style="width: 85%;" data-width="85"></div>
</div>
</li>
</ul>
</div>
</div>
</div>
-
我的问题是工具提示完全忽略了我的内联css/数据样式
<div class="level" style="width: 85%;" data-width="85"></div>
被渲染为
<div class="level">
是否有解决方案来禁用引导工具提示删除内联样式?设置参数santize:false已解决问题:
$('.tooltip').each(function () {
$(this).tooltip({
html: true,
sanitize: false,
title: $('#' + $(this).data('tip')).html()
});
});
我想引导团队希望尽量减少呈现工具提示的复杂性。有什么原因不能使用CSS类吗?另请参阅:@isherwood谢谢!sanitize:false使其正常工作:)非常感谢,没有使用许多css类,因为此工具提示内容在整个网站上都有所不同:)很好。一定要接受你的回答。