问题
While testing my application with different devices I found one weird problem in android browser in android phones.
I have almost same design for PC and and mobile, in PC and in iPhone and mobile Chrome browser its working fine.
<a type="cart_type" onclick="ajax_submit_for_new_order_session(81, true);
return false;" id="81" href="javascript:void(0)">
<i class="icon-plus-sign"></i></a>
Above is the code for my anchor tag, When I click on this anchor tag sometimes its calling the specified method and sometimes its not.
I am totally confused and scratching my head from so long for finding the issue but no luck.
Is there any problem with onclick in mobile devices?
回答1:
Solved the issue by updating the jQuery version to 1.11 earlier I am using 1.8
instead of using onclick
now I am using touchstart
or mousedown
this Solves the problem in all devices..
Its not problem with the code.. the delay taking by the browser is sometimes about 5 sec.
来源:https://stackoverflow.com/questions/21631597/javascript-ajax-click-event-sometimes-not-working-in-android-native-browser