2010-10-07 30 views

回答

2
$textarea.live("keyup", function() { 
    update(); 
}); 
+0

謝謝。它沒有給出錯誤,但仍然沒有工作。我查了更多的信息和http://stackoverflow.com/questions/1943552/live-for-jquery-elastic-plugin/1943581#1943581幫我解決了這個問題。 – Keverw 2010-10-07 07:38:32

0

http://api.jquery.com/live/

.live良好的語法.live(eventType, handler) 至少,寫這樣的:$textarea.live('keyup', update);如果你使用一個真正的處理程序或$textarea.live('keyup', function(){update();});如果你只使用一個函數一次。

+0

由於jquery 1.7 live已被棄用,並被替換爲.on()函數 – whosrdaddy 2012-12-06 15:35:45

0

嘗試

$textarea.live('keyup',update); 

PK

1

你爲什麼不使用的liveQuery?這很容易,工作正常。如果你有一個對象數組,使用一個類。在這種情況下,使用名爲matriz_producto_keyup的類。當我用ajax添加新數據時,livequery會識別事件並繼續執行腳本。

$(".matriz_producto_keyup").livequery("keyup", function(e){ 
    //if yoy want to know the id 
    var id=$(this).attrib("id"); 
    alert(id); 
}); 

享受該代碼。 http://www.jquery4u.com/function-demos/live/

相關問題