Add line break within tooltips

后端 未结 27 2618
北恋
北恋 2020-11-28 02:23

How can line breaks be added within a HTML tooltip?

I tried using
and \\n within the tooltip as follows:



        
27条回答
  •  清歌不尽
    2020-11-28 02:43

    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 = '
  • '; const liEnd = '
  • '; const bullet = '• '; var mergedString = ' '; const unOrderListStart='
      ' const unOrderListEnd='
    ' 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; } }

提交回复
热议问题