I am working on a existing VF code and added a comment like this, it appears on the page.

// Bla Bla Bla

I changed the comment to this, but receive the below error.

<! Bla Bla Bla> 

"The content of elements must consist of well-formed character data or markup".

What is the proper syntax for adding a comment to a visualforce page?

1 Answer 1


You should use the XML comment syntax, which is:

<!-- This is a comment -->
  • 1
    With the caveat that it's valid for text-only comments, but won't always "comment out" code.
    – crmprogdev
    Commented Mar 23, 2016 at 16:49
  • 3
    that will still appear in HTML response won't it? Is there a comment syntax which does not appear in the response at all?
    – NickJ
    Commented Nov 29, 2016 at 11:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .