tinymce エディター内にテキスト ボックスがあります。javascriptを使用してテキストボックスのテキストを変更したい。これがどのように可能か教えてもらえますか?ありがとうございました
1780 次
2 に答える
0
これは難しくありません。まず、エディターの本体を取得する必要があります。次に、テキストエリアを見つけようとすることができます。BIOS が示唆しているように、テキストエリアに ID を指定すると便利です。ここに必要なコードがあります
var editor = tinymce.get('your_editor_id');
$(editor.getBody()).find('textarea#your_textarea_id').innerHTML = 'my_new_text';
于 2012-11-14T09:34:21.677 に答える
-1
tinymcesetContentメソッドを使用してください。これがお役に立てば幸いです。
// Sets the HTML contents of the activeEditor editor
tinyMCE.activeEditor.setContent('<span>some</span> html');
// Sets the raw contents of the activeEditor editor
tinyMCE.activeEditor.setContent('<span>some</span> html', {format : 'raw'});
// Sets the content of a specific editor (my_editor in this example)
tinyMCE.get('my_editor').setContent(data);
// Sets the bbcode contents of the activeEditor editor if the bbcode plugin was added
tinyMCE.activeEditor.setContent('[b]some[/b] html', {format : 'bbcode'});
Tinymceのドキュメントを確認してくださいhttp://www.tinymce.com/wiki.php/API3:method.tinymce.Editor.setContent
于 2012-11-14T07:17:46.223 に答える