gpt4 book ai didi

textbox - 如何移动到 ionic 上的下一个输入字段

转载 作者:行者123 更新时间:2023-12-02 17:09:59 25 4
gpt4 key购买 nike

当我单击 ionic 键盘上的下一个按钮时,我想移动焦点。

但是它不起作用。没有任何操作。

如何将焦点移动到下一个文本框。

  <script id="page_menuList.html" type="text/ng-template">
<ion-header-bar style = "height:10%; background: none; border-bottom: none">
<a id = "button_backToDish" href="#/page_dish"></a>
</ion-header-bar>
<ion-view class = "page_menuList">
<ion-content id = "filter2" class = "no-header">
<button class="button button-full button-positive" ui-sref="page_profile" style = "margin-top:15%; background-color:transparent; color:#ffffff; font-size:18px; border: none; text-align:left; vertical-align:middle;">
<img src = "img/Menu/icon_profile.png" style = "width:6.5%; margin-left:3%; margin-top:3%;"> &nbsp; 내 정보
</button>
<button class="button button-full button-positive" ui-sref="page_basket" style = "margin-top:1.5%; background-color:transparent; color:#ffffff; font-size:18px; border: none; text-align:left; vertical-align:middle;">
<img src = "img/Menu/icon_basket.png" style = "width:6.5%; margin-left:3%; margin-top:2%;"> &nbsp; 주문 현황
</button>
<button class="button button-full button-positive" ui-sref="page_notice" style = "margin-top:1.5%; background-color:transparent; color:#ffffff; font-size:18px; border: none; text-align:left; vertical-align:middle;">
<img src = "img/Menu/icon_notification.png" style = "width:6.5%; margin-left:3%; margin-top:2%;"> &nbsp; 공지알림
</button>
<button class="button button-full button-positive" ui-sref="page_about" style = "margin-top:1.5%; background-color:transparent; color:#ffffff; font-size:18px; border: none; text-align:left; vertical-align:middle;">
<img src = "img/Menu/icon_about.png" style = "width:6.5%; margin-left:3%; margin-top:2%;"> &nbsp; About Us
</button>
<button class="button button-full button-positive" ui-sref="page_support" style = "margin-top:1.5%; background-color:transparent; color:#ffffff; font-size:18px; border: none; text-align:left; vertical-align:middle;">
<img src = "img/Menu/icon_support.png" style = "width:6.5%; margin-left:3%; margin-top:2%;"> &nbsp; Support
</button>
</ion-content>
</ion-view>
</script>

最佳答案

您好,您需要做的就是识别所有输入、文本区域和选择器以及按键。移至下一个字段。

app.directive('focusNext', function ()  {
return {
restrict: 'A',
link: function ($scope, element, attrs) {

element.bind('keydown', function(e) {
var code = e.keyCode || e.which;
if (code === 13) {
e.preventDefault();
//element.next()[0].focus(); This can be used if don't have input fields nested inside other container elements
var pageElements = document.querySelectorAll('input, select, textarea'),
element = e.srcElement
focusNext = false,
len = pageElements.length;
for (var i = 0; i < len; i++) {
var elem = pageElements[i];
if (focusNext) {
if (elem.style.display !== 'none') {
elem.focus();
break;
}
} else if (elem === e.srcElement) {
focusNext = true;
}
}
}
});
}
} })

希望这有帮助..

关于textbox - 如何移动到 ionic 上的下一个输入字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34117717/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com