zoukankan      html  css  js  c++  java
  • Kindeditor放置两个调用readonly错误

    开始

    需要调用Kindeditor中的readonly的方法,但是一直提示edit is undefined

    而editor.readonly(true)又只对第一个对象有效

    所以只能换换形式,干脆将下面的kindeditor拿上来

    虽然是满足自己这个需求,但是真正的原因解决办法,还是没有出来

    <script src="/assets/global/plugins/kindeditor/kindeditor.js" type="text/javascript"></script>
    <script src="/assets/global/plugins/kindeditor/lang/zh_CN.js" type="text/javascript"></script>
    <script type="text/javascript">
        var editor;
        var awardEditor;
        KindEditor.ready(function (K) {
            awardEditor = K.create('textarea[replace_name=award_show]', {
                minWidth: 400,
                allowFileManager: true,
                uploadJson: '/Merchant/KindEditor/Upload?IsWater=1',
                items: [
                        'source', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                        'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
                        'insertunorderedlist'],
                afterCreate: function () {
                    this.sync();
                },
                afterBlur: function () {
                    this.sync();
                },
                afterChange: function () {
                    $("textarea").each(function () {
                        $("#" + $(this).attr("replace_name")).html($(this).val());
                    })
                }
            });
            editor = K.create('textarea', {
                minWidth: 400,
                allowFileManager: true,
                uploadJson: '/Merchant/KindEditor/Upload?IsWater=1',
                items: [
                        'source', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                        'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
                        'insertunorderedlist'],
                afterCreate: function () {
                    this.sync();
                },
                afterBlur: function () {
                    this.sync();
                },
                afterChange: function () {
                    $("textarea").each(function () {
                        $("#" + $(this).attr("replace_name")).html($(this).val());
                    })
                }
            });
        });
        
    </script>
    View Code

     editor.readonly(true)作用的对象也同样是awardEditor所作用的对象,,

    awardEditor.readonly(true)有效

    这个问题先放着好了,纠结太久纯粹有些浪费时间,说不定等到什么时候就想通了

    突然发现上方的 K.create('textarea[name!=award_show]'是不可以的,即使加了!号,还是会进行两次初始化

    所以还是给改成 K.create('[name=mode_show],[name=require_show],[name=introduction_show]'

    至于两个对象的readonly都是第一个对象,大概只对第一个对象有用吧

  • 相关阅读:
    linux-vi/vim
    Linux性能监控-ss
    Linux性能监控-netstat
    Linux性能监控-sar
    Linux性能监控-htop
    Linux性能监控-pstree
    Linux性能监控-ps
    查看linux占用内存/CPU最多的进程
    Linux性能监控-top
    Linux-cpu-socket/core/processor
  • 原文地址:https://www.cnblogs.com/danlis/p/5447118.html
Copyright © 2011-2022 走看看