JavaScript document.execCommand() own tags JavaScript document.execCommand() own tags javascript javascript

JavaScript document.execCommand() own tags


Thanks to dandavis.

The following works very well:

document.execCommand("insertHTML", false, "<span class='own-class'>"+ document.getSelection()+"</span>");