The JS document.execCommand()
method is quite interesting. It can be used to execute certain commands to play with an editable region that is achieved either via the contenteditable
attribute or when the HTML document (of the main window or some iframe window) has been switched to designMode
using this code:
document.designMode = 'on'; // or 'off' // or for an iframe iframeNode.contentDocument.designMode = 'on'; // or 'off')
Infact try the first snippet right in dev tools and see what happens 🙂
Continue reading “JavaScript document.execCommand() Web Method”