I'm currently adding verbose tooltips to our site, and I'd like (without having to resort to a whizz-bang jQuery plugin, I know there are many!) to use carriage returns to format the tooltip.
To add the tip I'm using the title
attribute. I've looked around the usual sites and using the basic template of:
<a title='Tool?Tip?On?New?Line'>link with tip</a>
I've tried replacing the ?
with:
<br />
&013; /
\r\n
Environment.NewLine
(I'm using C#)
None of the above works. Is it possible?
will work in i.e. onlyAlso worth mentioning, if you are setting the title attribute with Javascript like this:
divElement.setAttribute("title", "Line one Line two");
It won't work. You have to replace that ASCII decimal 10 to a ASCII hexadecimal A in the way it's escaped with Javascript. Like this:
divElement.setAttribute("title", "Line one\x0ALine two");
I know I'm late to the party, but for those that just want to see this working, here's a demo: http://jsfiddle.net/rzea/vsp6840b/3/
HTML used:
According to this article on the w3c website:
This means that (at least) CR and LF won't work inside title attribute. I suggest that you use a tooltip plugin. Most of these plugins allow arbitrary HTML to be displayed as an element's tooltip.
This

should work if you just use a simple title attribute.on bootstrap popovers, just use
data-html="true"
and use html in thedata-content
attribute .On Chrome 16, and possibly earlier versions, you can use "\n". As a sidenote, "\t" also works