Reputation: 2717
I'm trying to break my custom HTML tooltip that I used inside the button Hover Button. I tried using different approach(ie., /n, 
) in typescript as it's a custom tooltip to add a line break and nothing seem to work.
Below is the tooltip data that I'm using and the fiddle associated with the same:
tooltipData="Helo,Angular 2" + "
" + "This button is used to test hover message" + "/n" + "This message should come at the last"
Upvotes: 0
Views: 5790
Reputation:
var =values["RAHUL","BIKASH","RAMAN"];
const liStart = '<li>';
const liEnd = '</li>';
const bullet = '• ';
var mergedString = ' ';
const unOrderListStart='<ul>'
const unOrderListEnd='</ul>'
const fakeNewline = '
';
for (let i = 0; i < values.length; i++) {
mergedString += liStart + bullet + values[i] + liEnd + fakeNewline;
}
const tempElement = document.createElement("div");
tempElement.innerHTML = unOrderListStart + mergedString + unOrderListEnd;
then use tempElement.innerText
Upvotes: 0
Reputation: 2014
Hi this code will work in all browser !!i used for new line in chrome and safari and ul li for IE
function genarateMultiLIneCode(){
var =values["a","b","c"];
const liStart = '<li>';
const liEnd = '</li>';
const bullet = '• ';
var mergedString = ' ';
const unOrderListStart='<ul>'
const unOrderListEnd='</ul>'
const fakeNewline = '
';
for (let i = 0; i < values.length; i++) {
mergedString += liStart + bullet + values[i] + liEnd + fakeNewline;
}
const tempElement = document.createElement("div");
tempElement.innerHTML = unOrderListStart + mergedString + unOrderListEnd;
return tempElement.innerText;
}
}
Upvotes: 1
Reputation: 86730
Try this -
<div title="Helo,Angular 2
This button is used to test hover message	This message should come at the last">Hover Me</div>
Here I used -

 - for New line
I Hope this will work for you.
Upvotes: 4
Reputation: 44087
You're using the wrong slash - new line should be \n not /n:
tooltipData="Helo,Angular 2" + "
" + "This button is used to test hover message" + "\n" + "This message should come at the last"
Upvotes: 1