我已创建工具提示,以显示<div>
<label class='form-control' data-toggle='tooltip' data-placement='bottom' title='something'>truncated text</label>
<div>
是否有截断的文字。
但我得到以下错误
错误:在初始化之前无法在工具提示上调用方法;试图调用方法&#39;选项&#39;。
我也尝试在省略号处于活动状态时调用它,但也不起作用。这有什么不对?这一切怎么办?
HTML:
$(document).on('mouseenter', ".form-control", function () {
var $this = $(this);
if (this.offsetWidth > this.scrollWidth) {
$this.tooltip('options', 'show');
}
});
脚本:
{{1}}
答案 0 :(得分:0)
根据tooltip docs,仅使用Dim cmb as ComboBox: Set cmb = ComBx.Object
cmb.value = ""
,
.tooltip('show')
您的代码应该是,
$this.tooltip('show');
代码段,
$(document).on('mouseenter', ".form-control", function () {
var $this = $(this);
if (this.offsetWidth > this.scrollWidth) {
$this.tooltip('show');
} else {
$this.tooltip('hide');
}
});
&#13;
$(document).on('mouseenter', ".form-control", function () {
var $this = $(this);
$this.tooltip('show');
});
&#13;