0

I am working a mobile website, using jQuery Mobile. Safari browser (5.1) not recognzing jQuery click event - like ("#button1").click (function (){ ...... });

Any idea?

Code Snippets:

$("#submit").click(function () {
    alert("hello");
});

<form id="loginForm" class="validate" action=""  method="get">
<input type="button" id="submit" name="submit" value="LOGIN" /> </form>
4

2 回答 2

0

The JavaScript click event is not always fired in some mobile browsers, so you may also have to bind to the tap event, like this:

$("#submit").bind("click tap", function () {
      alert("hello");
});

More information on jQuery Mobile events here: http://jquerymobile.com/test/docs/api/events.html

于 2012-06-30T03:38:26.390 回答
0
$("#submit").on("click", function () {
      alert("hello");
});

Please refer to

.on()

jQuery Mobile Event

于 2012-06-30T09:24:26.953 回答