Problem with tooltip Bootstrap when removing instance and creating another

1

I have a filter panel with several inputs , if some of these input does not pass a validation rule, it will instantiate a tooltip to signal the error.

The problem is when for example I have an input with the tooltip already instantiated, I need to change the text of this tooltip because another type of error was given, then I do a destroy and reinstall the toolip.

$('#input').tooltip('destroy');  
$('#input').tooltip({ title: 'texto nuevo'})

What happens when I do this, is that it only destroys the tooltip but does not create the new instance, then everything is left in nothingness.

What could I do in this case?

    
asked by Matias Llanos 25.07.2017 в 18:12
source

1 answer

1

the answer to your question would be this: validationFall is a class that I am applying to all input fields that also have tooltips applied to them.

$('.validacionFallida').each(function (index) {
    $(this).removeData('tooltip');
});

$('.tooltip').remove();

I have tried several different ways, and this was the only combination that allowed me to add tooltips after the deletion, without preventing the new tools from working correctly.

The .removeData allows tooltip information to be re-linked in the future.

answered by 25.07.2017 в 18:46