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

从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条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器