Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top