I have a problem with jQuery 1.6.4, iOS 5 and event logging of touchstart / touchhend (as indicated in the title, obviously).
Take the following code:
<!DOCTYPE html> <html lang="fr"> <head> <meta charset="utf-8" /> <script type="text/javascript" src="mmpa/jquery-1.6.4.min.js"></script> <script type="text/javascript"> $(document).ready(function() { var $body = $('body'); $('<button>').html('test jQuery').bind('touchstart', function() { alert('touchstart'); }).appendTo($body); }); </script> </head> <body> <button ontouchstart="alert('touchstart');">test pure JS</button> </body> </html>
The "pure JS" button shows a warning in iOS 4.3 and iOS 5, but the "jQuery" button only works on iOS 4.3. Tested on iPad / iPhone simulator, 4.3 and 5; also tested on real iPhone 4.3, iPhone 5.0 and iPad 5.0. Same reaction if I use <input type="button">
or even a simple <a>
instead of <button>
.
Is this a jQuery related issue, I suppose?
source share