Search code examples
javascripttinymcewysiwygtinymce-5

Tinymce with textarea content inside editor


I have the following markup im trying to initialize.

<textarea id="main">
    Some Text<br>
    <textarea class="foobar">[marker-123]</textarea>
</textarea>

Tinymce is stripping out the [marker-123] text from my sub textarea. I tried to keep it by doing the following but couldn't get it to work. Is there a better way to prevent Tinymce from stripping the contents of the inner textarea?

tinymce.init({
    extended_valid_elements: 'textarea[*]',
    editor_deselector : "foobar",
    ...
});

Solution

  • Selector with CSS class should start with dot(.). That is instead of calling the textarea with foobar you should use .foobar.