Search code examples
htmlcontenteditable

How to make clickable anchor in contentEditable div?


I have following code:

<div contentEditable="true">
  Blah blah <a href="http://google.com">Google</a> Blah blah
</div>

Fiddle

Is there a way to make this a clickable, not editable, without moving anchor outside that div?


Solution

  • Just wrap the link in another div, like so:

    <div contentEditable="true">
    
        <div contentEditable="false">
                Bla bla <a href="http://google.com">Google</a> Bla bla
        </div>
    </div>​