Adding keyup action to iframe of version of niceEdit

。_饼干妹妹 提交于 2019-12-11 11:23:14

问题


I am using nicEdit in its iframe format.Everytime the user write anything in the editor(keyup event), I need to run another js/jquery function. How to add this custom keyup action to the desired iframe?


回答1:


The answer actually lies in the js code. In the nicEdit.js search for :

var nicEditorIFrameInstance = nicEditorInstance.extend({

Inside this, in the initFrame function, look for this.frameDoc.addEvent. This is where the events are being added(via addEvent). To this include your keyup statement :

addEvent('keyup',this.YOURFUNCTIONAME.closureListener(this))

You need to add closureListener(this) to get this working.Then create YOURFUNCTION after initFrame function like this :

YOURFUNCTIONAME: function() {
//Do what you like. Probably call any JS function that lies in the file where 
//you have included the nicEdit.js
},

This method worked for me. Hope it does for you too. nicEdit is by far the worst documented third party stuff I have ever come across.



来源:https://stackoverflow.com/questions/13163545/adding-keyup-action-to-iframe-of-version-of-niceedit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!