Shooting Stars
Shooting Stars

Reputation: 835

TinyMCE not saving exact code in code editor

When I use TinyMCE, it doesn't save the exact code I put into the code editor.

For example I will have an initial value of

<p> Write your description here </p>

When I go into the code editor, and add

<span> Hello there </span>

it will switch it back to a <p> tag over the span tag. So it will be

<p> Hello there </p>

Is there any way to make sure the TinyMCE editor saves it exactly?

Upvotes: 0

Views: 243

Answers (1)

Anees Hikmat Abu Hmiad
Anees Hikmat Abu Hmiad

Reputation: 3550

You need to allow the span tag to be acceptable in your text-area, and you can add it via this extended_valid_elements:

tinymce.init({
    extended_valid_elements: 'span',
    //...other options
}); 

for more details click here

Upvotes: 2

Related Questions