4

I am using the bootstrap multiselect plugin provided by 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 I want to remove the tooltip I have also tried to disable the button title attribute whoes value is displayed in the tooltip. but it doesn't work. My current code is like this.
Current HTML with PHP Code:

<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 with multiselect initialization:

$('#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');
Arshad
  • 135
  • 2
  • 13

5 Answers5

6

To remove tooltip you need to override buttonTitle function in your options.

$('#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() {},
});
2

If I understood yor question properly then your willing to remove the tool tip then try this

<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>

to remove tooltip use this code`

$('#speciality').tooltip('hide')

Or

$('#speciality').tooltip('destroy')
aditya shrivastava
  • 724
  • 1
  • 8
  • 24
2

I think I found answer myself. I removed the title attribute of the button that was being displayed as tooltip. My revised code is here.
Revised JQuery Code

$('#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"); 
SUB0DH
  • 5,130
  • 4
  • 29
  • 46
Arshad
  • 135
  • 2
  • 13
0

In Js part this code works for me

 $('.multi-selectpicker').multiselect({
      includeSelectAllOption: true,
      enableFiltering: true,
      nonSelectedText: 'Select Groups',
      buttonTitle: function() {},
 });
 $('button[class="multiselect dropdown-toggle btn btn-default"]').removeAttr("title"); 
Nick
  • 21
  • 2
0

$(document).on('mouseover','.multiselect ',function(){ $(this).removeAttr('title'); });

Dilli
  • 79
  • 4