javascript - execCommand insertHtml in Internet Explorer -


I am creating a wysiwyg-editor with execcommands using an editable iframe. Now I have to use the 'insertHtml' command which works correctly in Chrome and Firefox, but of course it does not work in Internet Explorer.

What is the standard solution to this problem? It's okay if it works only in IE8 but IE7 support will also be good

In IE & Lt; = 10 You can use the pasteHTML method to represent the text range selection:

  var doc = document.getElementById ("your_iframe" ). ContentWindow.document; If (doctor selection & amp; doc.selection.createRange) {var range = doc.selection.createRange (); If (range.paste HTML) {range.paste HTML ("& lt; b & gt; some bold text & lt; / b & gt;"); }}  

UPDATE

In IE 11, go to document.selection and enter HTML is still not supported, so you'll need the following:


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -