开发者

Jquery live keyup not working

开发者 https://www.devze.com 2023-03-03 14:32 出处:网络
I have text box <input type=\"text\"name=\"extraQty0\"class=\"extraEvent\" value=\"1\"/> used following code

I have text box

<input type="text"  name="extraQty0"  class="extraEvent" value="1"/>

used following code

$(".extraEvent").live('keyup',function(){
   alert('test');
});  

This is not working But if i use 'click' instead of 'keyup' the alert will work. What coul开发者_StackOverflow中文版d be wrong?


As mentioned in the comments, you are using jQuery version 1.3.1. Support for the keyup event for live() wasn't introduced until later. Update your jQuery to either the latest version or at least 1.4.x and you should be fine.

Source


That's strange. Could you try this:

$(document).ready(function(){
  $(".extraEvent").live('keyup', function(){
    alert('test');
  });  
});

Hope this helps. Cheers

0

精彩评论

暂无评论...
验证码 换一张
取 消