Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I am using tinymce, Is it possible to apply for only one textarea

I am using tinymce, I have multiple text areas on my page. Is it possible to apply for only one textarea,

1 text area is for description validation is like below

 var text = tinyMCE.get('txtdesc').getContent(); 

But i have more 3 more text areas in my page so tineMCE should not apply for all these text areas

How can i apply only for one text area

 // this is my tinyMCE code      tinyMCE.init({         mode : "textareas",         theme : "advanced"     });  // /tinyMCE 
like image 607
Navruk Avatar asked Mar 04 '11 10:03

Navruk


2 Answers

For the textarea assign a class="" to textarea property, this will support for you

<script type="text/javascript">     tinyMCE.init({         //mode : "textareas",         mode : "specific_textareas",         editor_selector : "myTextEditor",         theme : "simple"     }); </script>  <textarea id="txtdesc" name="txtdesc" class="myTextEditor" rows="6" cols="96" ></textarea> 
like image 132
chinna Avatar answered Sep 25 '22 23:09

chinna


In the TinyMCE 3.x config you can put class selectors or deselectors to specifically enable or disable TinyMCE on textareas with certain classes, just put the class="" attribute on your textarea.

editor_deselector : "mceNoEditor" // class="mceNoEditor" will not have tinyMCE editor_selector : "mceEditor", // class="mceEditor" will. 

Source.


As of TinyMCE 4.0.x

selector: "textarea", // Select all textarea selector: "textarea.editme", // Select all textarea with the class editme selector : "textarea:not(.mceNoEditor)", // Select all textarea exluding the mceNoEditor class 

Source.

like image 31
Dunhamzzz Avatar answered Sep 24 '22 23:09

Dunhamzzz