jQuery Mobile tap bug : same target twice

Posted by hugo on Stack Overflow See other posts from Stack Overflow or by hugo
Published on 2012-12-14T17:01:46Z Indexed on 2012/12/14 17:03 UTC
Read the original article Hit count: 158

Filed under:
|
|
|
|

I'm working on displaying some text in an UIWebView on iOS. I'd like to get the content of the HTML element tapped by the user. If he taps on a paragraph for example, a popup shows the paragraph content. I'm using jQuery Mobile to achieve this. Here's what I'm doing :

$('body').tap(function(e) {
    var tappedElement = $(e.target);

    alert(tappedElement.text());  
});

It works for the first tap. The second tap no matter where it is, returns the same text.

The event seems to be ok but the target property of the second tap is wrong. On the third tap all comes back to normal and so on ... What am I missing here ? thx

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about ios