1

I have a tooltip but it fails to hide on button click.

This is my button :

<button class="btn btn-outline-inverse ajax_addtocart additems                                                                             
         data-toggle="tooltip" title="Add to cart"                                                                                         
         id="<?php echo $item->id ?>">
    <i class="fa fa-shopping-cart"></i>
    <span class="select_options">Add to cart</span>
</button>

This is the button click :

$("button.additems").click(function(e){ //user clicks form submit button
    e.preventDefault();
    var button = $(this);
    var form_data = $(this).attr("id"); //prepare form data for Ajax post
    button.prop('disabled', true); //Loading button text //change button text

     .............. Continues to do ajax after ajax request
 button.prop('disabled', false)

The tootltip stays displayed.

I have tried adding

button.tooltip('hide')   //this also fails

I have also tried this and

Community
  • 1
  • 1
Geoff
  • 6,277
  • 23
  • 87
  • 197

1 Answers1

4

If you are using a jQuery UI tooltip, have you tried the close method?

button.tooltip('close');
jrbedard
  • 3,662
  • 5
  • 30
  • 34