Search code examples
javascriptjqueryhtmljquery-tooltip

How to change tooltip of a div tag through Javascript?


currently I am using Jquery to append text on to tooltip like this;

$('#test').attr('title', $('#test').attr('title') + ' text to append');

What I would like to know is, how can I achieve this via javascript?

Any help is welcomed, I did some research but had no luck.

Easy Tooltip content change via Javascript

Changing the tooltip of button dynamically in html


Solution

  • Check this it work same like you have done in jquery

    document.getElementById("test").title = document.getElementById("test").title + 'text to append';