$textarea.keyup(function(){ update(); });
我厭倦將實時功能添加到它。像下面在jquery中使用.live作爲文本區域的關鍵點
$textarea.live(keyup(function(){ update(); }));
,但我得到
Uncaught ReferenceError: keyup is not defined
我在做什麼錯?
$textarea.keyup(function(){ update(); });
我厭倦將實時功能添加到它。像下面在jquery中使用.live作爲文本區域的關鍵點
$textarea.live(keyup(function(){ update(); }));
,但我得到
Uncaught ReferenceError: keyup is not defined
我在做什麼錯?
$textarea.live("keyup", function() {
update();
});
的.live
良好的語法.live(eventType, handler)
至少,寫這樣的:$textarea.live('keyup', update);
如果你使用一個真正的處理程序或$textarea.live('keyup', function(){update();});
如果你只使用一個函數一次。
由於jquery 1.7 live已被棄用,並被替換爲.on()函數 – whosrdaddy 2012-12-06 15:35:45
嘗試
$textarea.live('keyup',update);
PK
你爲什麼不使用的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://stackoverflow.com/questions/1943552/live-for-jquery-elastic-plugin/1943581#1943581幫我解決了這個問題。 – Keverw 2010-10-07 07:38:32