0

This code runs in Chrome, but not in Android Browser or Chrome for Android 18 (Android 4.2; CyanogenMod 10.1):

$(function(){
    $(".save").click(function(){
        alert('Saved');
    });
});

​ Working example: http://jsfiddle.net/BCVdc/4/

Is there some jQuery/Android Browser incompatibility?

RESOLVED: error was unrelated to this code...

Martin
  • 1,312
  • 1
  • 15
  • 18

5 Answers5

1
$(function(){
    $(".save").click(function(){
        alert('Saved');
        return false;
    });
});

Above code should does the trick for you.

Techie
  • 44,706
  • 42
  • 157
  • 243
0

I don't have an Android browser to test in, but you may be having problems with a link not having a valid href attribute.

As an aside, this is also why some browsers won't apply the default anchor CSS to it as well. ie. the usual blue and underlined.

Owen Berry
  • 401
  • 3
  • 2
0

Try this code

$(function(){
    $(".save").live('tap',function(event){
        alert('Saved1');
    });
$(".save").live('click',function(event){
        alert('Saved2');
    });
});

Please test it in your android and tell us which alert is shown.

Ahmed Assaf
  • 601
  • 7
  • 25
0

I've had a similar issue while trying to use the .click method on stock android browsers. Seems like substituting .click with $('selector').on('click', cb); solves the issue.

ronalddddd
  • 111
  • 2
  • 8
0

in mobile not working click, but can use onchange function.

$(function(){
  $('.save').on('change', function (event) {
    event.preventDefault();
    alert('Saved');
  });
});