问题
I want to use 2 different textareas with tinyMCE in the same form. The first one works well but whenever I am adding the 2nd one, the 2nd one disabled (it enables when I enlarge it manually from bottom right corner). Their field name and id is different.

Can anyone tell me how can I fix this problem?
Thanks in advance.
回答1:
Since there is no code from you we cant figure out where your problem is. Maybe to go a way around, init TinyMce for both Textareas over a class:
<script type="text/javascript" src="<your installation path>/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "simple",
editor_selector : "mceSimple"
});
tinyMCE.init({
mode : "textareas",
theme : "advanced",
editor_selector : "mceAdvanced"
});
</script>
<form method="post" action="somepage">
<textarea name="content1" class="mceSimple" style="width:100%">
</textarea>
<textarea name="content2" class="mceAdvanced" style="width:100%">
</textarea>
</form>
Cheers, Stefan
回答2:
If you resize the tinymce's area, the text magically appears.
Mikko Huilaja's javascript solution:
<script type="text/javascript">
$(window).load(function() {
forceTinyMceIframeResize();
});
function forceTinyMceIframeResize() {
$('.mceEditor .mceIframeContainer iframe').each(function(i) {
$(this).height($(this).height()+1);
});
}
</script>
回答3:
Use a common class (e.g tinymce-editor) for all the text area for which you need to add TinyMCE.
Then in HTML head section add the following code to initialize TinyMCE.
$(function(){
tinyMCE.init({
selector: '.tinymce-editor',
statusbar: false,
min_height: 120,
menubar: false,
toolbar: 'styleselect | bold italic underline | undo redo | image | link',
plugins: 'image, link',
forced_root_block: false,
default_link_target: "_blank",
link_assume_external_targets: true
});
});
来源:https://stackoverflow.com/questions/9783141/how-to-enable-multiple-tinymce-in-the-same-form