【问题标题】:how to check textarea has edit or not如何检查textarea是否有编辑
【发布时间】:2014-08-27 06:14:06
【问题描述】:

您好,我在文本区域上使用 tinymce 作为编辑器,但我无法检查 IF 文本区域文本是否更改,因为我将它从数据库加载到 javascript,我发现编辑器没有更新内容更改为 html,所以当我用 javascript 检查时,它说仍然没有变化

加载编辑器的脚本

tinymce.init({
    selector: ".editor",
    plugins: [
        "image",
    ],
    toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"
});

【问题讨论】:

    标签: php tinymce textarea


    【解决方案1】:

    很抱歉很久才回答我的问题, 放在这里我如何检测到tinymce TextArea的值变化

     textArea = '<?php if (isset($course['description'])) echo $course['description']; ?>';
    $(window).bind('beforeunload', function(eventObject) {
        returnValue = undefined;
        if (!isSave) {
    
            for (var i = 0; i < inputs.length; i++) {
                if (values[i] != inputs[i].value) {
                    returnValue = "";
                }
            }
            tinyMCE.triggerSave();
            if (tinymce.get('description').getContent() != textArea) {
                returnValue = "";
            }
        }
        eventObject.returnValue = returnValue;
        return returnValue;
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-05-08
      • 2014-03-19
      • 2017-07-17
      • 1970-01-01
      • 1970-01-01
      • 2011-06-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多