Reputation: 2124
I'm trying the following to add a linebreak in the title
attribute.
<p id="test" title="1|2">test</p>
var lineBreak = $("<div>
</div>").html();
$("#test").attr("title", $("#test").attr("title").replace("|", lineBreak));
The tooltip result in IE9 is
1
2
in IE8 the result is
12
Is there a chance to fix this for IE8? I really need this way and no custom tooltip etc.
Try it @ jsfiddle: http://jsfiddle.net/8ZCdb/
Upvotes: 2
Views: 532
Reputation: 56429
Try this:
$("#test").attr("title", $("#test").attr("title").replace("|", "\n"));
\n
is a new line operator in plain text.
Upvotes: 5