如何隐藏 bootstrap 多选悬停工具提示?
How to hide the bootstrap multiselect hover tooltip?
我正在使用 http://davidstutz.github.io/bootstrap-multiselect/. I am facing problem with the hover over tooltip with all selected values. It displays unexpected results like in given image.tootip unexpected results 提供的 bootstrap 多选插件
我想删除工具提示我还尝试禁用工具提示中显示其值的按钮标题属性。但它不起作用。
我现在的代码是这样的。
当前 HTML 与 PHP 代码:
<select class="form-control" multiple name="speciality[]" id="speciality">
<?php if($data=$user->getAllSpecialities()){
foreach($data as $key => $value) {?>
<option selected value="<?php echo $value['speciality_id'];?>">
<?php echo $value['speciality_title'];?>
</option>
<?php }
}?>
</select>
Jquery 多选初始化:
$('#speciality').multiselect({
nonSelectedText: 'Select Speciality',
numberDisplayed: 2,
buttonClass: 'btn btn-default',
buttonWidth: '100%',
includeSelectAllOption: true,
allSelectedText:'All',
selectAllValue: 0,
selectAllNumber: false,
maxHeight: 100,
onSelectAll: function() {
$('button[class="multiselect"]').attr('title',false);
}
});
//$('#speciality').tooltip().attr('title', 'all specialities');
如果我正确理解了你的问题,那么你愿意删除工具提示,然后试试这个
<select class="form-control" data-toggle="tooltip" data-placement="left" title="Tooltip on left" multiple name="speciality[]" id="speciality">
<?php if($data=$user->getAllSpecialities()){
foreach($data as $key => $value) {?>
=<option selected value="<?php echo $value['speciality_id'];?>">
<?php echo $value['speciality_title'];?>
</option>
<?php } }?></select>
要删除工具提示,请使用此代码`
$('#speciality').tooltip('hide')
或者
$('#speciality').tooltip('destroy')
我想我自己找到了答案。我删除了显示为工具提示的按钮的标题属性。我修改后的代码在这里。
已修订 JQuery 代码
$('#speciality').multiselect({
nonSelectedText: 'Select Speciality',
numberDisplayed: 2,
buttonClass: 'btn btn-default',
buttonWidth: '100%',
includeSelectAllOption: true,
allSelectedText:'All',
selectAllValue: 0,
selectAllNumber: false,
maxHeight: 100,
onDropdownHidden: function(event) {
// to remove the title when dropdown is hidden so we can remove the title generated by the plugin
$('button[class="multiselect dropdown-toggle btn btn-default"]').removeAttr("title");
}
});
$('button[class="multiselect dropdown-toggle btn btn-default"]').removeAttr("title");
要删除工具提示,您需要覆盖选项中的 buttonTitle 函数。
$('#speciality').multiselect({
nonSelectedText: 'Select Speciality',
numberDisplayed: 2,
buttonClass: 'btn btn-default',
buttonWidth: '100%',
includeSelectAllOption: true,
allSelectedText:'All',
selectAllValue: 0,
selectAllNumber: false,
maxHeight: 100,
onSelectAll: function() {
$('button[class="multiselect"]').attr('title',false);
},
buttonTitle: function() {},
});
在Js部分
此代码对我有用
$('.multi-selectpicker').multiselect({
includeSelectAllOption: true,
enableFiltering: true,
nonSelectedText: 'Select Groups',
buttonTitle: function() {},
});
$('button[class="multiselect dropdown-toggle btn btn-default"]').removeAttr("title");
$(document).on('mouseover','.multiselect ',function(){ $(this).removeAttr('title'); });
我正在使用 http://davidstutz.github.io/bootstrap-multiselect/. I am facing problem with the hover over tooltip with all selected values. It displays unexpected results like in given image.tootip unexpected results 提供的 bootstrap 多选插件
我想删除工具提示我还尝试禁用工具提示中显示其值的按钮标题属性。但它不起作用。
我现在的代码是这样的。
当前 HTML 与 PHP 代码:
<select class="form-control" multiple name="speciality[]" id="speciality">
<?php if($data=$user->getAllSpecialities()){
foreach($data as $key => $value) {?>
<option selected value="<?php echo $value['speciality_id'];?>">
<?php echo $value['speciality_title'];?>
</option>
<?php }
}?>
</select>
Jquery 多选初始化:
$('#speciality').multiselect({
nonSelectedText: 'Select Speciality',
numberDisplayed: 2,
buttonClass: 'btn btn-default',
buttonWidth: '100%',
includeSelectAllOption: true,
allSelectedText:'All',
selectAllValue: 0,
selectAllNumber: false,
maxHeight: 100,
onSelectAll: function() {
$('button[class="multiselect"]').attr('title',false);
}
});
//$('#speciality').tooltip().attr('title', 'all specialities');
如果我正确理解了你的问题,那么你愿意删除工具提示,然后试试这个
<select class="form-control" data-toggle="tooltip" data-placement="left" title="Tooltip on left" multiple name="speciality[]" id="speciality">
<?php if($data=$user->getAllSpecialities()){
foreach($data as $key => $value) {?>
=<option selected value="<?php echo $value['speciality_id'];?>">
<?php echo $value['speciality_title'];?>
</option>
<?php } }?></select>
要删除工具提示,请使用此代码`
$('#speciality').tooltip('hide')
或者
$('#speciality').tooltip('destroy')
我想我自己找到了答案。我删除了显示为工具提示的按钮的标题属性。我修改后的代码在这里。
已修订 JQuery 代码
$('#speciality').multiselect({
nonSelectedText: 'Select Speciality',
numberDisplayed: 2,
buttonClass: 'btn btn-default',
buttonWidth: '100%',
includeSelectAllOption: true,
allSelectedText:'All',
selectAllValue: 0,
selectAllNumber: false,
maxHeight: 100,
onDropdownHidden: function(event) {
// to remove the title when dropdown is hidden so we can remove the title generated by the plugin
$('button[class="multiselect dropdown-toggle btn btn-default"]').removeAttr("title");
}
});
$('button[class="multiselect dropdown-toggle btn btn-default"]').removeAttr("title");
要删除工具提示,您需要覆盖选项中的 buttonTitle 函数。
$('#speciality').multiselect({
nonSelectedText: 'Select Speciality',
numberDisplayed: 2,
buttonClass: 'btn btn-default',
buttonWidth: '100%',
includeSelectAllOption: true,
allSelectedText:'All',
selectAllValue: 0,
selectAllNumber: false,
maxHeight: 100,
onSelectAll: function() {
$('button[class="multiselect"]').attr('title',false);
},
buttonTitle: function() {},
});
在Js部分 此代码对我有用
$('.multi-selectpicker').multiselect({ includeSelectAllOption: true, enableFiltering: true, nonSelectedText: 'Select Groups', buttonTitle: function() {}, }); $('button[class="multiselect dropdown-toggle btn btn-default"]').removeAttr("title");
$(document).on('mouseover','.multiselect ',function(){ $(this).removeAttr('title'); });