<button>事件未在ipad上触发</button>

时间:2014-02-27 17:41:37

标签: jquery html ipad twitter-bootstrap

当键盘打开时,jQuery .click事件没有被触发......

虽然这不是一个主要问题,但它让我的客户感到沮丧,最终用户需要为单个事件点击两次按钮......你必须先关闭键盘才能触发事件。

我也尝试将 标记更改为 标记,但也没有运气。

我正在使用bootstrap框架,按钮被放置在模态对话框中。

我一直在寻找,很久没有找到任何运气了。所以我非常感谢你的帮助和支持。

更新

以下是模态的内容:

<div class="input-group input-sm">
<span class="input-group-addon"><i class="fa fa-user"></i></span>
<input class="form-control" name = "userid" type="text" id="userid" placeholder="Username" />
</div>
<div class="input-group">
<span class="input-group-addon"><i class="fa fa-lock"></i></span>
<input class="form-control" name = "password" type="password" id="password" placeholder="Password" />
<input type="hidden" name="submitted" value="TRUE" />
</div>
<div class = 'row' id = "options">
<input type = "hidden" id = "pkey"/>
<input  type=button id = 'sign-in' class = 'btn btn-primary col-xs-12 col-sm-5' style = "height:85px;" value = "Sign In" />
<input type=button id = 'sign-out' class = 'btn btn-danger col-xs-12 col-sm-5 pull-right' style = "height:85px;" value = "Sign Out" />
</div>

这是jQuery:

$("#staff").click(function () {
checksession();
//hasstaffaccess();
$("#modal-title").html("Staff Login");
$("#modal-body").load("staff.php", function () {
    openmodal();
    $("#sign-in").click(function () {
        //alert($("#userid").val() + $("#password").val());
        $.get("ajax/verifystaff.php?username=" + $("#userid").val() + "&password=" + $("#password").val() + "&inout=in", {
            username: $("#userid").val(),
            password: $("#password").val(),
            inout: "in"
        }, function (data) {
            //invalidlogon          

            for (var key in data) {
                //alert(key);
                if (key == "invalidusername" || key == "invalidpassword" || key == "invalidlogon") {
                    alert("Inavild Username/Password");
                }
                if (key == "error") {
                    alert(data.error);
                }
                if (key == "successful_logon") {
                    if (data.successful_logon != "") {
                        updateinstructions(data.successful_logon);
                        closemodal()
                    }
                }
            }
        }, "json");
    })
    $("#sign-out").click(function () {
        //alert($("#userid").val() + $("#password").val());
        $.get("ajax/verifystaff.php?username=" + $("#userid").val() + "&password=" + $("#password").val() + "&inout=out", {
            username: $("#userid").val(),
            password: $("#password").val(),
            inout: "out"
        }, function (data) {
            //invalidlogon          

            for (var key in data) {
                //alert(key);
                if (key == "invalidusername" || key == "invalidpassword" || key == "invalidlogon") {
                    alert("Inavild Username/Password");
                }
                if (key == "error") {
                    alert(data.error);
                }
                if (key == "successful_logon") {
                    if (data.successful_logon != "") {
                        updateinstructions(data.successful_logon);
                        closemodal();
                    }
                }
            }
        }, "json");
    })


})
})

对不起,我的编码可能不是最直接的.....:S

1 个答案:

答案 0 :(得分:1)

您必须绑定到touchstart事件。

<强>参考:
https://developer.mozilla.org/en-US/docs/Web/Reference/Events/touchstart