【问题标题】:bootstrap js tooltip display html contentbootstrap js工具提示显示html内容
【发布时间】:2019-10-18 07:59:59
【问题描述】:
我正在尝试在工具提示标题上显示 html 内容。
但正在显示纯文本。
<a href="javascript:void(0);" data-html="true" data-toggle="tooltip1" title="<p><label>package_qty</label> (0 status)</p>">0</a>
以及初始化:
$('[data-toggle="tooltip1"]').tooltip();
将data-html 值设置为true 似乎不起作用。
我正在使用引导版本3.3.7。
【问题讨论】:
标签:
javascript
bootstrap-4
tooltip
twitter-bootstrap-tooltip
【解决方案1】:
希望这些链接可以帮助您,祝您有美好的一天!
讨论Can I use complex HTML with Twitter Bootstrap's Tooltip?
小提琴http://jsfiddle.net/44khF/200/
$('.tooltip-demo.well').tooltip({
selector: "a[rel=tooltip]"
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet"/>
<div class="tooltip-demo well">
<p style="margin-bottom: 0;" class="muted">Tight pants next level keffiyeh you probably haven't heard of them. Photo booth beard raw denim letterpress vegan messenger bag stumptown. Farm-to-table seitan, mcsweeney's fixie sustainable quinoa 8-bit american apparel have a terry richardson vinyl chambray. Beard stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, four loko mcsweeney's cleanse vegan chambray. A <a title="<h1><b>Another</b> <em>one</em> here too</h1>" data-html="true" rel="tooltip" href="#">really ironic</a> artisan whatever keytar, scenester farm-to-table banksy Austin twitter handle freegan cred raw denim single-origin coffee viral.
</p></div>