Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
27
rated 0 times [  30] [ 3]  / answers: 1 / hits: 62220  / 12 Years ago, thu, august 2, 2012, 12:00:00

I have some textareas and all of them are with tinyMCE.



I would like to set the content of the specific textarea, but I can't find how.



I have tryed this:



 tinyMCE.get('title').setContent(selected_article_title);


here is my textarea:



<textarea style=width: 95%; name=Title  id=title></textarea>


And here my tinyMCE init:



tinyMCE.init({
// General options
mode : specific_textareas,
theme : advanced,
width: 100%,
plugins : pagebreak,paste,fullscreen,visualchars,

// Theme options
theme_advanced_buttons1 : code,|,bold,italic,underline,|,sub,sup,|,charmap,|,fullscreen,|,bullist,numlist,|,pasteword,
theme_advanced_buttons2 :,
theme_advanced_buttons3 :,
theme_advanced_buttons4 :,
theme_advanced_toolbar_location : top,
theme_advanced_toolbar_align : left,
theme_advanced_statusbar_location : bottom,
valid_elements : i,sub,sup,
invalid_elements : p, script,
editor_deselector : mceOthers
});


I don't know why this is not working, I am using the exemple from the tinyMCE website http://www.tinymce.com/wiki.php/API3:method.tinymce.Editor.setContent


More From » tinymce

 Answers
14

I have the solution (thans to Thariama who gives me some elements)



To set the content of an textarea using tinyMCE, we heve to fill in the textarea before init the tinyMCE. Also, the response is as follows:




  1. Create the textarea:



    <textarea style=width: 95%; name=Title  id=title></textarea>

  2. Set the content of the textarea:



    $('#title').html(selected_article_title);

  3. Init the tinyMCE:



    tinyMCE.init({
    // General options
    mode : specific_textareas,
    theme : advanced,
    width: 100%,
    plugins : pagebreak,paste,fullscreen,visualchars,

    // Theme options
    theme_advanced_buttons1 : code,|,bold,italic,underline,|,sub,sup,|,charmap,|,fullscreen,|,bullist,numlist,|,pasteword,
    theme_advanced_buttons2 :,
    theme_advanced_buttons3 :,
    theme_advanced_buttons4 :,
    theme_advanced_toolbar_location : top,
    theme_advanced_toolbar_align : left,
    theme_advanced_statusbar_location : bottom,
    valid_elements : i,sub,sup,
    invalid_elements : p, script,
    editor_deselector : mceOthers
    });



And it's done ! Enjoy.


[#83899] Wednesday, August 1, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
cortez

Total Points: 326
Total Questions: 106
Total Answers: 110

Location: Slovenia
Member since Wed, Apr 6, 2022
2 Years ago
;