Lets start with our problem,
We were facing a weird issue in experience editor, where we are getting following error –
XHTML markup is incorrect near placeholder “header”. For more information about this issue refer to Sitecore Knowledge base article https://kb.sitecore.net/articles/365101.
I know this error message shows when there some XHTML validation problem. But In our case its not related to XHTML validation.
What was weird!!!!!!
The weird thing here was that if I change my placeholder key “header” (i.e. – “Header” or “header1”) and update the presentation details, it resolve the problem. Don’t konw what is problem with “header” placeholder key. here the code we are using on layout –
We were using Sitecore version – 8.2 update 2
I ask this question on Sitecore stackexchange (Link), but didn’t get any solution.
First solution I try was rebuilding indexes using the Indexing Manager from the Control Panel and check whether the issue is still reproducible. I did the same but it was still there.
It’s still reproducible after rebuilding the indexes becasue it was not related to indexing. I found the root cause of this problem and it was related to some jquery function, in the header html a section has id=”header” and some jquery functions are based on this id in a custom jquery file “jquery.layout.js”.
Since our placeholder key and the id jquery using was same. Then updated the id in both jquery and html and it resolve my problme every thing worked like a charm.
I ask question to sitecore support that what was wrong in this js file? and don’t you recommend to use placeholder key as id in html? I after a good discussion here is the moral of all story –
The issue may be caused by the behavior when a placeholder expands to a div with an id similar to its key. Thus, if you already have the same id in your markup, the validation error occurs. To avoid the issue please consider giving the unique key value to your placeholders (as for me (“me” and “I” here is sitecore support persoon), I create them with the ‘ph’ prefix, e.g. phMain, phContent).
and that’s it.