just add the attribute 'editor_selector' in tinyMCE.init . The value for this attribute is a css class name which should be used in the textarea where you want to apply editor.
For ex:
tinyMCE.init({
mode : "textareas",
theme : "simple",
editor_selector :"mceEditor"
});
and in the textarea tag
<textarea name="description" style="width:100%;" class="mceEditor">
Its better to use tinyMCE.execCommand('mceAddControl', false, 'mceEditor'); instead of tinyMCE.init();
ReplyDeleteHere; "mceEditor" is id of Text area.
You can use tinyMCE.execCommand("mceRemoveControl", false, "mceEditor"); on body/page unload to remove it from DOM.
tinyMCE.init({
ReplyDeletemode : "exact",
elements : "description",
theme : "simple",
editor_selector :"mceEditor"
);
I ve doubt on mode
Deletemode:"textarea" it means it apply to all?
thanks a lot :)
ReplyDeleteUseful article. thanks
ReplyDeleteI'm building a web app in MVC 3, using JQuery Dialog and TinyMCE, I kept getting "j is null" error every second time I tried to save the record via ajax call back.
ReplyDeleteI solved it by make sure I called tinyMCE.execCommand('mceAddControl', false, 'mceEditor');
on page (partial view) load, and called
tinyMCE.execCommand("mceRemoveControl", false, "mceEditor")
when dialog is closing.
thanks for the hint.
Thanks Alot
ReplyDeleteWhere should I put that TinyMce.init code? Should the TinyMce package be in the same folder where your website directory is?
ReplyDeleteWhere should I put that TinyMce.init code?
ReplyDeleteTinyMce.init - you can put code before !! end body !! tag at the end.
Should the TinyMce package be in the same folder where your website directory is?
No its not necessary. You just need to make sure that JavaScript is included properly in your page; where you need TinyMce.
Thanks, you can use the "exact" method and then specify the ID of the textarea as the elements that need to use tinyMCE. EG:
ReplyDeletetinyMCE.init({
...
mode : "exact",
elements : "elm1,elm2"
});
...
<textarea id="elm1" ...
Thanks, This help a lots of time.
ReplyDeleteGood Article, Helped A Lot, Thx.
ReplyDeleteThis doesn't seem to work in TinyMCE 4. Am I missing something?
ReplyDelete