2012-10-31 13 views
1

我正在使用它的IFRAME nicEdit的版本IFRAME format.Everytime用戶在編輯器(keyup事件)什麼,我需要運行另一個JS/jQuery函數。如何將此自定義鍵控動作添加到所需的iframe?添加KEYUP行動的niceEdit

回答

1

答案實際上在於js代碼。在nicEdit.js搜索:

var nicEditorIFrameInstance = nicEditorInstance.extend({ 

這裏面,在initFrame功能, 找this.frameDoc.addEvent。 這是添加事件的地方(通過addEvent)。這個包括您KEYUP聲明:

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

您需要添加closureListener(this)得到這個working.Then這樣initFrame功能後,創建yourFunction中:

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

此方法爲我工作。希望它也適合你。 nicEdit是迄今爲止最糟糕的記錄第三方的東西,我曾經碰到過。