javascript - angularjs tab key press prevent default - Stack Overflow

Hi I have a input field that calls the funciton add_plu() when the tab key is pressed down.Although i

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
Add a ment  | 

1 Answer 1

Reset to default 5

The 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();

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745046414a4608125.html

相关推荐

  • javascript - angularjs tab key press prevent default - Stack Overflow

    Hi I have a input field that calls the funciton add_plu() when the tab key is pressed down.Although i

    7小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信