Multiline tooltip doesn’t work programmatically

Tags: ,

is supposed to separate lines on tooltip hover.

This doesn’t work:

var doesntwork = document.getElementById("doesntwork")
doesntwork.title = "line1

But doing it in the html works:

<div title="line1
asdfas" id='works'>

See an example of this here, just hover on the squares:

Is there something I’m missing?


I run into this issue all the time. For some reason xml special chars work fine when entered into the xml but not when they are added via javascript. It is very annoying

I am not sure if it is a solution you can use, but instead of using you could use n

doesntwork.title = "line1nasdfa";

Source: stackoverflow