vytaux
vytaux

Reputation: 2562

problem with inserting HTML with insertHTML

I'm trying to make wysiwyg editor with content editable divs and I'm inserting html with document.execCommand('insertHTML', false, html); but the problem is, when i insert link, and then i want to write after it continues to write INSIDE that link.

EXAMPLE:

how it does now:

Hello, <a>stackoverflow.com MyTextAfterLink</a>

how it should be:

Hello, <a>stackoverflow.com</a> MyTextAfterLink

How could i fix this? Thanks.

Upvotes: 1

Views: 505

Answers (1)

austin cheney
austin cheney

Reputation:

Try assigning to the innerHTML property of a DOM node instead.

Upvotes: 1

Related Questions