![](/img/trans.png)
[英]IBM Worklight 6.1 - How to display the iOS keyboard with a “Go” button?
[英]IBM Worklight 6.1 - How to detect the keyboard's “Search” button?
我們正在使用IBM Worklight 6.1開發混合移動應用程序。
對於iOS,如何處理顯示的軟鍵盤上的“搜索”按鈕事件?
“句柄”有點模糊...您要完成什么?
如果您針對特定需要調用正確的鍵盤,則無需檢測任何按鈕。
僅當您的input
標簽位於form
元素內時,才會出現iOS鍵盤中的搜索按鈕。
例如:
// This will display a return button.
<input id="textField" type="text"/>
// This will display a search button.
<form>
<input id="searchField" type="search"/>
</form>
在JavaScript中,一旦點擊了搜索按鈕,就可以使用jQuery keypress
事件觸發操作。 例如:
$("#searchField").keypress(function() {
alert("Handler for .keypress() called.");
});
在“搜索”的情況下,您還可以“檢測”鍵盤的“類型”,如下所示(但這很明顯...):
if ($("#searchField").attr("type") == "search") {
alert("This search field is of type 'search'.");
}
否則,您將需要實現本機代碼(即Cordova插件 )來檢測當前顯示的鍵盤的類型並執行操作等。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.