Skip to content
Advertisement

Multiline tooltip doesn’t work programmatically

is supposed to separate lines on tooltip hover.

This doesn’t work:

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

But doing it in the html works:

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

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

https://jsfiddle.net/foreyez/3yg535jq/

Is there something I’m missing?

Advertisement

Answer

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";
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement