dongpaipu8394
2013-07-29 09:25
浏览 253
已采纳

从tinymce获取数据

Hi in a wizard on a confirmation tab i try to get the content from the tinymce editor. But it doesn't work. With normal textareas it works without any problems.

Example normal Textarea:

<div class="control-group">
<label class="control-label">MyValue<span class="required">*</span></label>
<div class="controls">
<textarea class="span12 m-wrap" style="max-width:100%;" name="MyValue" rows="7"></textarea>
</div></div>

Code to show text from textarea on the confirmation page:

<div class="control-group">
<label class="control-label">MyValue</label>
<div class="controls">
<span class="text display-value" data-display="MyValue"></span>
</div>
</div>

My JavaScript code:

        var displayConfirm = function() {
            $('.display-value', form).each(function(){
                var input = $('[name="'+$(this).attr("data-display")+'"]', form);
                if (input.is(":text") || input.is("textarea")) {
                    $(this).html(input.val());
                } else if (input.is("select")) {
                    $(this).html(input.find('option:selected').text());
                } else if (input.is(":radio") && input.is(":checked")) {
                    $(this).html(input.attr("data-title"));
                } else if ($(this).attr("data-display") == 'htmlinhalt') {
                    $(this).html($('[name="htmlinhalt"]', form).val());
                } 
            });
        }

But why it doesn't work with a tinymce textarea? I think I must get the content directly from tinymce not from textarea, but how?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

3条回答 默认 最新

  • dpgua04022 2013-07-29 10:23
    最佳回答

    Try

    tinymce.get('your_textarea_id').getContent();
    
    评论
    解决 无用
    打赏 举报
查看更多回答(2条)

相关推荐 更多相似问题