开发者

problem with inserting HTML with insertHTML

开发者 https://www.devze.com 2022-12-31 09:05 出处:网络
I\'m trying to make wysiwyg editor with content editable divs and I\'m inserting html w开发者_开发知识库ith document.execCommand(\'insertHTML\', false, html); but the problem is, when i insert link, a

I'm trying to make wysiwyg editor with content editable divs and I'm inserting html w开发者_开发知识库ith 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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消