Tengo un área de texto y estoy usando tinyMCE en ese área de texto.Establecer el valor de textarea con javascript después de la inicialización de TinyMCE
Lo que estoy haciendo en realidad es que cuando la página se abre, estoy poblando el área de texto con algo de texto, y después de eso estoy inicializando el tinyMCE.
El problema es cuando estoy tratando de cambiar el valor del área de texto después de la inicialización de tinyMCE, y luego no pasa nada.
Aquí hay un ejemplo.
Crear el área de texto:
<textarea style="width: 95%;" name="title" id="title"></textarea>
Rellenar el área de texto:
$('#title').html("someText");
Inicializando 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" });
me gustaría Chan ge el contenido de la Vista de Texto (pero no está funcionando)
he tryed para utilizar el mismo que antes de inicio del TinyMCE
$('#title').html("someModifiedText"); // does not work
También he probado a lo quite TinyMCE:
if(tinyMCE.getInstanceById('title'))
removeTinyMCE("title");
Con
function removeTinyMCE (dialogName) {
tinyMCE.execCommand('mceFocus', false, dialogName);
tinyMCE.execCommand('mceRemoveControl', false, dialogName);
}
Y Thet de reutilizar:
$('#title').html("someModifiedText"); // does not work
estoy fuera de ideas ... muchas gracias por su ayuda ....
Gracias de nuevo Thariama, estoy geting un error aquí: tinymce.get ('título') no está definido –
consulte [este] (http://www.tinymce.com/wiki.php/API3:method.tinymce.Editor.setContent) – Prasanth
@goldenparrot, gracias, ya probé pero sigue siendo el mismo problema. –