admin管理员组文章数量:1410737
Hi I have a input field that calls the funciton add_plu() when the tab key is pressed down. Although it works, it moves to the next element of the page (default action for a tab key).
How do I prevent the tab button from it's default behaviour? Here is my code:
<input class="order-input-plu form-control" ng-model="order.orderwindow.add_field" ui-keydown="{ 'tab':'add_plu(order.orderwindow.add_field)'}">
Hi I have a input field that calls the funciton add_plu() when the tab key is pressed down. Although it works, it moves to the next element of the page (default action for a tab key).
How do I prevent the tab button from it's default behaviour? Here is my code:
<input class="order-input-plu form-control" ng-model="order.orderwindow.add_field" ui-keydown="{ 'tab':'add_plu(order.orderwindow.add_field)'}">
Share
asked May 6, 2014 at 23:41
user1424508user1424508
3,30113 gold badges42 silver badges67 bronze badges
1 Answer
Reset to default 5The ui-key* directives provide the event in the scope, so you can add $event to the function call and do something with it.
ui-keydown="{ 'tab':'add_plu(order.orderwindow.add_field, $event)'}"
Then modify your add_plu to take the $event param, and call $event.preventDefault();
本文标签: javascriptangularjs tab key press prevent defaultStack Overflow
版权声明:本文标题:javascript - angularjs tab key press prevent default - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745046414a2639392.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论