Execcommand formatblock headings in IE

Spend hours of trying to figure out why

document.execCommand('formatBlock',false,'h1');

is not working.

It is because you need to do this for ie

document.execCommand('formatBlock',false,'<h1>');

Two refs:

1. http://stackoverflow.com/questions/10741831/execcommand-formatblock-headings-in-ie

2.  http://help.dottoro.com/larpvnhw.php

String that specifies the name of the element. 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 – h6address and preelements.

Advertisements
Standard