0

I have an issue on a big app that I cannot reproduce on a basic test page :

In a contentEditable div I have an onclick function that triggers

document.execCommand("bold", false, "");

On a basic test page, when I hit it the first time it adds <strong>text</strong> tags. But when I hit it a second time, i expect it to clear the strong tags and go back to "text"

On the big app, I end up addindg more and more tags, like <strong><strong><strong>text</strong></strong></strong>

Any idea of what is making that ?

Reporter
  • 3,897
  • 5
  • 33
  • 47
Adrien NGUYEN
  • 199
  • 1
  • 6
  • Please post your code. – Nice Books Sep 27 '21 at 14:47
  • It seems you work with jscript, not javascript. – Reporter Sep 27 '21 at 15:05
  • I also created a simple example to test it, and as you mentioned, it works correctly in a simple test page. I'm not sure what environment you are describing for the big application. Is it possible that it is affected by the font style? Refer to [this case](https://stackoverflow.com/questions/28614760/execcommand-doesnt-unbold-text). – Xudong Peng Sep 28 '21 at 07:20
  • thanks Xudong Peng I'll have a look if css is messing things up or not – Adrien NGUYEN Sep 29 '21 at 20:51

0 Answers0