jQuery events on iOS 5 -


i'm having issue jquery 1.6.4, ios 5 , registration of touchstart/touchend events (as stated in title, obviously).

take 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 alert in ios 4.3 , ios 5, "jquery" button works on ios 4.3. tested on ipad/iphone simulator, 4.3 , 5 ; tested on real iphone 4.3, iphone 5.0, , ipad 5.0. same reaction if use <input type="button"> or simple <a> instead of <button>.

is problem related jquery believe?

answered guy on apple dev forums: need bind() after element has been added dom, so:

var btn = $('<a>').html('test jquery').appendto($body); btn.bind('touchstart', function(e) { alert('touchstart'); }); 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -