I'm not whether this question is a duplicate, and I'm sorry if it is.
I have this plugin that works on the admin side. There, I have a page on which I need to print at least one TinyMCE editor. After reading the codex, I figured out that I could print one to the front-end using wp_editor.
<?php wp_editor("Some text", "my-editor");?>
However, I need to make some changes to this editor on certain events. For instance, there's a case where the editor should be hidden on a button click; I also need to get texts from and into the editor's text area in certain situations, this should be done dynamically via JS/JQuery.
I thought that it would be possible to do all those things by just selecting the editor id (my-editor) just like any other element. Things didn't turn out the way I expect. I've tested some JQuery, here's how it might look like:
$("#btn-hide-editor").click(function() {
$("#my-editor").css("display", "none");
});
For this specific case of making the display property equal none, I've also tried to wrap the editor with a div and, then, make that div "display: none". It doesn't work either.
I would be grateful if anyone could point out what I'm missing here and what might be a solution.
EDIT 1:
This "issue" only occurs when on the Visual tab of the editor. My code seems to work for the Text tab. Ideally, I wish to be a be able to use the Visual tab, so this is still an issue.