Skip to content
Advertisement

Use tinymce editor only once textarea

I am using tinymce editor and i have 4 textarea in my form when i use tinymce change all my textarea to editor but i want change only one my textarea to editor. it’s my tinymce code:

 <script type="text/javascript">
  tinymce.init({
   selector: "textarea",
    plugins: [
    "advlist autolink lists link image charmap print preview anchor",
    "searchreplace visualblocks code fullscreen",
    "insertdatetime media table contextmenu paste ",
    "textcolor"
   ],
  toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter   alignright alignjustify | bullist numlist outdent indent | link image | forecolor backcolor"
 });
  </script>

how can do it? thank you

Advertisement

Answer

Read this article in the TinyMCE manual. Use mode either with specific_textareas or exact.

Your initialisation code should look like this:

tinyMCE.init({
    ...
    mode : "specific_textareas",
    editor_selector : "YourOwnEditor"
});

…or…

tinyMCE.init({
    ...
    mode : "exact",
    elements : "myarea1"
});

…and your HTML could look like this:

<textarea id="myarea1" class="YourOwnEditor">This will be the editor!</textarea>
<textarea id="myarea2">This will not be an editor.</textarea>
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement