In principle, this is not possible. The tooltip created by the attribute titleis created as elements of the operating system and is located outside the browser window.
On the other hand, everything you create with Javascript will be part of the web page and therefore limited to the outside of the browser window.
There is nothing you can do about it. Unfortunately.
(I note that the @easwee comment links refer to a question that is answered that provides a solution, however this solution is only for IE and will work in any other browser)
source
share