Execcommand formatblock headings in IE

firefox, google-chrome, html, internet-explorer, javascript

Solution

The problem seems to be one of syntax. IE expects the tag to be formatted while the other browsers don't.

See here:

In Internet Explorer, the name of the element must be placed between tag delimiters (such as `<H1>`). Firefox, Opera, Google Chrome and Safari support all block elements, Internet Explorer supports only the h1 - h6, address and pre elements

Problem

I want to format selected text to a heading, the way I am doing it works fine in Firefox and Google Chrome but it doesn't work in IE9, here is how I do it: ``` document.execCommand('formatBlock',false,'h1'); ``` Does anyone know how to achieve the same task in Internet Explorer 9?

Original source