2010-08-10 25 views
4

有沒有一種方法可以將點擊事件處理程序添加到jeditable(jQuery插件)中?我想要做的是,當你點擊一些可編輯的元素,並顯示「確定」和「取消」按鈕的輸入元素,我想添加一些文本按鈕,點擊應該重定向到另一個URL 。jeditable:帶有「確定」和「取消」的附加按鈕

可以這樣做嗎?任何形式的幫助都非常感謝。預先感謝您的時間和精力。

此致敬禮。

回答

4

我想你可以使用jQuery's live()方法來添加一個按鈕創建jEditable的跨度/輸入元素後...
所以也許會有這樣的工作...

$('.editable').live('click', function() { 
    // Live handler called. 
    // And here's where it gets tricky with jEditable...the jQuery selector below may be all wrong 
    $('.editable').append('<button type="submit" class="gotourl">Go to URL</button>'); 
}); 

然後

$('.gotourl').live('click', function(){ 
    // Place your redirect code here 
} 

只是試圖在提交設置添加另一個按鈕和工作確定

submit: '<button type="submit" class="ok">OK</button> <button type="submit" class="gotourl">Go To URL</button>' 

所以然後當你點擊Go To URL按鈕時,實時方法應該會觸發......但jEditable也會運行......所以你必須調試它才能讓它一起工作......

相關問題