JavaScript document.execCommand remove formatBlock formatting?

contenteditable, formatting, html, javascript

Solution

I suppose `document.execCommand('removeFormat',false,false)` would do it?

Issuing `document.execCommand('formatBlock', false, 'div')` on the `<h1>`-block will remove the `<h1>`-tag and replace it with a `<div>`-tag 1. Would that be viable?

1 If you're not using IE that is

Problem

If I format a piece of text on a page like this: ``` document.execCommand('formatBlock', false, 'h1'); ``` What do I do to remove this formatting?

Original source