2

When I create a div with a link, and I toggle the editor, JCE removes the entire link code from the div.

This is the example:

<a href="#"><div id="test">text or image here</div></a>

When I toggle editor to see the result, and than back to the code view, this is the result:

<div id="test">text or image here </div>

So I don't understand why JCE removes the link outside of the div. I put there the link cause I would like the entire div with its background to be clickable.

If I save the article, when I'm in the code view, it saves the link! So it remove this only if I change to the visual way when I'm editing the article.

isherwood
  • 58,414
  • 16
  • 114
  • 157
MagenNew
  • 21
  • 4

1 Answers1

1

<div> is a block element and <a> is an inline element ahd before HTML5 putting a block inside of any inline element was not valid. This is why I suspect that JCE would wipe it out; in pre HTML5 this would be invalid markup. In HTML5 you can put a block element inside of <a> it, but I'm not sure if there is a setting in JCE to get it to validate with HTML5. You should probably ask on their forums. This link gives you some more detail.

Community
  • 1
  • 1
Elin
  • 6,507
  • 3
  • 25
  • 47