• 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都是第一个对象,大概只对第一个对象有用吧

  • 相关阅读:
    oracle视图总结(转)
    tomcat web.xml 配置
    绑定命令的具体应用
    oracle数据导入的常用命令
    hibernate学习笔记6--Criteria查询方式、完整小练习(开发步骤)
    Github常见错误
    排序函数中比较函数cmp的理解
    Hdu 4143
    Wireshark 基本使用方法
    Valgrind 初次接触
  • 原文地址:https://www.cnblogs.com/danlis/p/5447118.html
Copyright © 2020-2023  润新知