30 September 2012 at 7:13am
Hoping there is an easy solution...
Using SilverStripe 3.0.2, and I'm trying to insert "Anchors" in to an HTMLEditorField. Something like <a name="anchor"></a>. However, when I save my page the tag ends up being converted to a self-closing <a> tag like this: <a name="anchor" />. This results in browsers thinking there's an unclosed tag on the page and causing some general bugginess.
Does anyone know what's happening here or how to prevent it? I think it's SilverStripe making this change and NOT TinyMCE (viewing the source in TinyMCE still shows separate opening and closing tags).
30 September 2012 at 8:13am
You may want to consider asking why you are doing this as there are likely better solutions. If you want to create the ability to link to parts of the page I would recommend adding ids (not names) to the elements you want to link to. I'm digging into my memory banks here but I seem to remember that a LONG time ago (maybe even as far as Netscape 3?) there were browsers that couldn't do internal page links to ids on elements and required and empty <a> element. Now you can just add an id to an element and link to it no problem.