Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery: How to show bootstrap tooltip

In my case, tooltip is coming when user place mouse on input control but I want to trigger tooltip. Means when validation will fail, then tooltip will be display below input control.

this is the code i am using to show tooltip. just tell me what to edit in this code.

var options = { html: true, placement: 'bottom', title: '<div class="tooltip-alert alert-danger" data-placement="bottom">' + message + '</div>' };
        $(inputElement).addClass('validation-error');
        inputElement.tooltip("destroy")
            .addClass("error")
            .tooltip(options);

thanks

like image 864
Thomas Avatar asked Oct 28 '25 11:10

Thomas


2 Answers

Use this way:

$(element).tooltip("show");

So, when the validation error occurs, you need to use:

inputElement.tooltip("show");
like image 158
Praveen Kumar Purushothaman Avatar answered Oct 30 '25 02:10

Praveen Kumar Purushothaman


After going through the comments, I feel you need a static tooltip to be displayed when there is an error.

Bootstrap tooltip trigger=manual is what you require.

Here is the fiddle for you : Fiddle

Edit Added Hide button to hide tooltip.

Fiddle# 2

Hope this helps.

-Help :)

like image 27
Help Avatar answered Oct 30 '25 00:10

Help



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!