javascript - JQuery live doesn't work - Stack Overflow

I try to get .live content into a div when there is a keyup... I looked at the forumtopic here but I di

I try to get .live content into a div when there is a keyup... I looked at the forumtopic here but I didn't find the answer...

Why does my code not works? I use this JQuery:

<script type="text/javascript" src="jquery-ui-1.7.1.custom.min.js"></script> 


<script type="text/javascript">

$(document).ready(function() {
// When the document is ready set up our sortable with it's inherant function(s)

  $(".atleetnaamlink").live('keyup', function(){
    alert('test');
  });  
</script>

I try to get .live content into a div when there is a keyup... I looked at the forumtopic here but I didn't find the answer...

Why does my code not works? I use this JQuery:

<script type="text/javascript" src="jquery-ui-1.7.1.custom.min.js"></script> 


<script type="text/javascript">

$(document).ready(function() {
// When the document is ready set up our sortable with it's inherant function(s)

  $(".atleetnaamlink").live('keyup', function(){
    alert('test');
  });  
</script>
Share Improve this question asked Nov 10, 2012 at 9:30 Olivier PeetersOlivier Peeters 612 silver badges7 bronze badges 1
  • $(selector).live(events, data, handler); // jQuery 1.3+ $(document).delegate(selector, events, data, handler); // jQuery 1.4.3+ $(document).on(events, selector, data, handler); // jQuery 1.7+ – Pragnesh Chauhan Commented Nov 10, 2012 at 9:30
Add a ment  | 

4 Answers 4

Reset to default 3

try on

$(selector).live(events, data, handler);                // jQuery 1.3+
$(document).delegate(selector, events, data, handler);  // jQuery 1.4.3+
$(document).on(events, selector, data, handler);        // jQuery 1.7+

$(document).ready(function() {
 $("body").on('keyup' ,'.atleetnaamlink', function(){
   alert('test');
 });  
});

DEMO

.live() is deprecated. Use .on() instead. That will work.

$(".atleetnaamlink").on('keyup', function(){
    alert('test');
}); 

You are missing }); and Working demo http://jsfiddle/JwRRH/

Hope it helps :) by the way live is deprecated and if you keen check this out What's wrong with the jQuery live method?

code

  $(document).ready(function() {
    // When the document is ready set up our sortable with it's inherant function(s)

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

or*

 $(document).ready(function() {
        // When the document is ready set up our sortable with it's inherant function(s)

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

Add this above:

<script type="text/javascript" src="http://code.jquery./jquery-latest.js"></script> 
<script type="text/javascript" src="jquery-ui-1.7.1.custom.min.js"></script> 

and see if this works.

and important thing not to forget to accept it if it solves your issue.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745649435a4638170.html

相关推荐

  • javascript - JQuery live doesn&#39;t work - Stack Overflow

    I try to get .live content into a div when there is a keyup... I looked at the forumtopic here but I di

    4小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信