Showing posts with label iOS. Show all posts
Showing posts with label iOS. Show all posts

February 27, 2013

jquery click event in iOS

When binding a click event to the element, iOS may not work as expected. It is because if you write something like below, it won't work. Maybe it is iOS bug/jQuery bug?

$('#button1').click(function() {
    alert('button1');
});
The work around fix is to set pointer cursor to the element, and use .on to bind click event.

$('#button1').css('cursor','pointer');
$(document).on('click', '#button1',  function(event) {
    event.preventDefault()
    alert('button1');
});