I need to add a line break in a tooltip. I tried using ASCII character "
" to insert a new line feed. This works like a charm in normal HTML page. It even works just fine when you add it through the Browser console. However, it is not rendered as a linefeed in case of a VF Page, all I see is "Line 1 
 Line 2" in the tooltip. So, I've the following questions.

  1. How is the ASCII converted to special characters in a HTML page and where is it getting converted? Is the browser responsible?
  2. How do I get it working in Salesforce VF Page?

Here is the sample I've tried. Thanks in advance!

<apex:page showHeader="false" sidebar="false" standardStyleSheets="false">
    <apex:outputText title="Line 1 &#13; Line 2" value="Hi" ></apex:outputText>

apex:outputText by default will escape all text entered in it. You will need to use escape="false" to get the line break to appear.

<apex:outputText escape="false" title="Line 1 &#13; Line 2" value="Hi" ></apex:outputText>

Be aware that setting this value to "false" may be a security risk because it allows arbitrary content, including JavaScript, that could be used in a malicious manner.

  • It doesn't work for me. Not sure what I'm missing here. – Vignesh Damodharan Nov 24 '14 at 12:29
  • You could try using the HTML <br/> tag instead of &#13; – BarCotter Nov 24 '14 at 12:51
  • Doesn't work either! Also, I cannot use escape="false"since I'm working with a managed package and will not clear security check from salesforce if I use it. – Vignesh Damodharan Nov 25 '14 at 5:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.