我正在開發用於iPad的PhoneGap應用程序。在一個屏幕上,你必須填寫一個約20個文本框的表單。作爲輸入字段才反應過來的點擊事件(其中有這樣的時間不長,但尚未惱人的延遲),我嘗試以下防止輸入字段上的點擊事件
$('input[type="text"], input[type=number], input[type=date], input[type="tel"], input[type=password], input[type="email"], input[type="url"], textarea, select').live("touchend", function(e) {
if(!swipe) {
$(this).focus();
}
swipe = false;
return false;
});
(我的TouchMove事件檢查刷卡)
該作品,但現在我想阻止輸入上的原始點擊事件。 問題是,當使用.focus()方法激活輸入字段時,鍵盤會彈出並將頁面滑動一點點,然後單擊事件被觸發並激活另一個輸入字段我期望的輸入。
對於防止點擊我已經嘗試過
$('input[type="text"], input[type=number], input[type=date], input[type="tel"], input[type=password], input[type="email"], input[type="url"], textarea, select').live("click", function(e) {
return false;
});
,但這也不起作用:(
是否有另一種伎倆立即激活輸入字段後,我摸了一下沒有任何延遲?
已經過了一年..你應該指定正確的答案 –