Give \n
between the text. It work on all browsers.
Example
img.tooltip= " Your Text : \n"
img.tooltip += " Your text \n";
This will work for me and it's used in code behind.
Hope this will work for you
The solution for me was http://jqueryui.com/tooltip/:
And here the code (the part of script that make <br/>
Works is "content:"):
HTML HEAD
<head runat="server">
<script src="../Scripts/jquery-2.0.3.min.js"></script>
<link href="Content/themes/base/jquery-ui.css" rel="stylesheet" />
<script src="../Scripts/jquery-ui-1.10.3.min.js"></script>
<script>
/*Position:
my => at
at => element*/
$(function () {
$(document).tooltip({
content: function() {
var element = $( this );
if ( element.is( "[title]" ) ) {
return element.attr( "title" );
}
},
position: { my: "left bottom-3", at: "center top" } });
});
</script>
</head>
ASPX or HTML control
<asp:TextBox ID="Establecimiento" runat="server" Font-Size="1.3em" placeholder="Establecimiento" title="Texto 1.<br/>TIP: texto 2"></asp:TextBox>
Hope this help someone
Since 
(html) is 0D
(hex), this can be represented as '\u000d'
str = str.replace(/\n/g, '\u000d');
Sharing with you guys an AngularJS filter that replaces \n
with that character thanks to the references in the other answers
app.filter('titleLineBreaker', function () {
return function (str) {
if (!str) {
return str;
}
return str.replace(/\n/g, '\u000d');
};
});
usage
<div title="{{ message | titleLineBreaker }}"> </div>
Using .html() instead of .text() worked for me. For example
.html("This is a first line." + "<br/>" + "This is a second line.")
just use \n in title and add this css
.tooltip-inner {
white-space: pre-wrap;
}
You can use bootstrap tooltip, and don't forget to set the html option to true.
<div id="tool"> tooltip</div>
$('#tool').tooltip({
title: 'line one' +'<br />'+ 'line two',
html: true
});
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>