The following DHTML formatting commands each work fine on a div with contentEditable=true
in IE, Firefox and Chrome:
document.execCommand("superscript", false, null);
document.execCommand("subscript", false, null);
However, calling the command again to remove the formatting has no effect in Chrome.
Am I missing something or is this a bug in Chrome?
I had a similar problem. For me, the problem was due to some "normalization" CSS altering vertical-align: baseline
for sup and sub tags. Overriding that CSS and setting sub to vertical-align: sub
and sup to vertical-align: super
fixed it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With