0

I have a webpage disigned for mobile devices, most of the data is loaded into it via AJAX request and appended to the BODY with jQuery, so far it works just fine.However, when I try to attach an on click listener, the following listener doesn't work for any browser

$('[id^="the_content"]').click(function () {
...
});

I've solved this problem by using the On() method. the following code work perfectly on all browsers (tested on Chrome,FF,IE,Safari for windows). except for the build browser.

$(document).on("click",'[id^="the_content"]',function() {
...
});

Note that these listeners does work for data which was not appended via JS/jQuery

Note that my code pass W3C HTML5 validation with no errors at all.

Have anyone faced such a problem?

div example:

<div id='the_content_id_61'>...</div>
Kirill Kulakov
  • 10,035
  • 9
  • 50
  • 67

1 Answers1

0

Rather than using click events, make use of touch events.

Refer to the touch Handler function on this $(document).click() not working correctly on iPhone. jquery

Community
  • 1
  • 1
Siva Charan
  • 17,940
  • 9
  • 60
  • 95