Kindeditor放置两个调用readonly错误
生活随笔
收集整理的這篇文章主要介紹了
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都是第一個對象,大概只對第一個對象有用吧
總結
以上是生活随笔為你收集整理的Kindeditor放置两个调用readonly错误的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Eclipse字体颜色控制
- 下一篇: 解决npm下载慢或者下载不了的问题-三种