最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Jquery keyup not working on Android - Stack Overflow

programmeradmin1浏览0评论

i didn't tested this code on iPhone but i'm sure (tested) it doesn't works on android mobiles:

 $('#search').live('keyup',function(key){
          if(key.which == 13){
            /*ANIMATE SEARCH*/
            _key = $(this).val();
            $("#wrapper").html("");
                $('#wrapper').hide(0).load('results.html').fadeIn(800);
                $('#search-fade').val(_key).fadeIn();
          }
      });

to explain better :

i have a simple

<input type="text" name="search" id="search"/>

don't know why but this code doesn't works properly on android mobile phones

any ideas?

i didn't tested this code on iPhone but i'm sure (tested) it doesn't works on android mobiles:

 $('#search').live('keyup',function(key){
          if(key.which == 13){
            /*ANIMATE SEARCH*/
            _key = $(this).val();
            $("#wrapper").html("");
                $('#wrapper').hide(0).load('results.html').fadeIn(800);
                $('#search-fade').val(_key).fadeIn();
          }
      });

to explain better :

i have a simple

<input type="text" name="search" id="search"/>

don't know why but this code doesn't works properly on android mobile phones

any ideas?

Share Improve this question asked May 14, 2012 at 9:02 Filippo orettiFilippo oretti 49.8k96 gold badges229 silver badges351 bronze badges 2
  • 2 you should try on() instead on live(), cause live() is deprecated. – The System Restart Commented May 14, 2012 at 9:13
  • I have reviewed the available information and changed my answer. – user1051870 Commented May 16, 2012 at 20:16
Add a comment  | 

2 Answers 2

Reset to default 10
$(document).on('keyup','#search', function() {
   // code
});

or

$(document).delegate('#search', 'keyup', function() {
    // code
});

You can also see here

My solution (working with jQuery 1.7.1):

$('#search').live('input paste', yourFunction)

Tip:

Use .on() instead of .live(), because:

  • .on() is faster
  • .live() is deprecated

jQuery 1.7+ .on() vs .live() Review

Try this:

$(document).on('input paste', '#search', yourFunction)
发布评论

评论列表(0)

  1. 暂无评论