function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
waylonatcimwaylonatcim 

HTML tags and strings

I have the following code on a visualforce page:

 

<apex:outputText escape="false" >
 <h1>
  {!description}
 </h1>
</apex:outputText>

 

 

Where description is a string in my component that is set as the following:

 

 

description = 'Description:<ul><li>Bullet Point</li></ul>';

 

Unfortunately the output on the screen is:

Description:<ul><li>Bullet Point</li></ul>

Where the h1 tags are working correctly, but anything that comes from the string value in the controller is displayed literally.  Is there any way to display the string as I'm hoping, with the list being displayed properly?

 

Thanks!

 

aballardaballard

escape=false controls the text that is included by the value attribute of apex:outputText.  

 

Try:

<h1>

<apex:outputText escape="false" value="{!description}"/>

</h1>

 

 

As always when using escape=false, you should make sure you are not creating a security hole that would facilitate cross-site scripting.