I am trying to update the title of the bootstrap tooltip dynamically but end up in getting two tooltips.
I have a paragraph
<p> Some text </p>
which is then parsed into the tokens.
$('p').each(function() {
            var $this = $(this);
            $this.html($this.text().replace(/\b(\w+)\b/g, "<span data-toggle='translatetip' title='old'>$1</span>"));
        });
// bind to each span
    $('p span').hover(
        function() { 
         
            $('#word').text($(this).css('background-color','#ffff66').text());
            $(this).tooltip('enable').attr('title', 'new');
            console.log($(this).tooltip().attr('title'));
        },
        function() { 
            $('#word').text(''); $(this).css('background-color',''); 
        }
        
    );
The above code creates span for every word in the paragraph and on hover the word is highlighted and the tooltip appears. I tried to change the tooltip text on hover dynamically but that does not work. Can anyone please help.
This is the output i am getting.

 
    