How to Convert A Tab Key Press Into An Enter Key Press For Web Pages?

Bir

I am create a form in html for submit data. When I shall reach save button by tab press and press tab again then tab will act as a Enter key. That means data will save. How can i do this?

I have use the following code

 <form id="form">
<input type="text" />
<input type="text" />
<input type="text" />
<input disabled="disabled" />
<input readonly="readonly" value="readonly" />
<textarea></textarea>

<input type="submit" />

$(":input").on("keydown", function(event) {
    if (event.which == 9) {
        event.startPropagation();
    }
});

Please tell me the solution.

Jarry

an alternative to mjalajel 's answer

$("input[type='submit']").on("keyup", function(event) {
    if (event.which == 9) {
        $(this).trigger('click');
    }
});

this way whatever you have on click event is called

if you want to follow a link, you have to replace

$(this).trigger('click');

with

this.click();

this is because jquery click event isn't the same as a "real" click more info here: jQuery: how to trigger anchor link's click event

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

GtkButton发出GDK_KEY_PRESS

来自分类Dev

Matplotlib'key_press_event'不响应

来自分类Dev

Vim exit Insert mode with some key press

来自分类Dev

on_key_press()事件阻止on_mouse_press()和on_mouse_motion()事件持续1秒

来自分类Dev

InputMap - register a keystroke that monitors key press, and no virtual repeats

来自分类Dev

PyAutoGUI Key Press在Linux Ubuntu中性能降低

来自分类Dev

如何将参数传递给fig.canvas.mpl_connect('key_press_event',on_key)中的on_key?

来自分类Dev

How to prevent the Enter key to submit form

来自分类Dev

使用key_press_event为不同类型的pick_event选择一个“模式”

来自分类Dev

使用key_press_event为不同类型的pick_event选择一个“模式”

来自分类Dev

Vim的“ Press Enter”提示符下的映射键

来自分类Dev

为什么对字符串使用“ \ t”而不是“ <press TAB>”?

来自分类Dev

Angular2 make textarea press enter without new line added

来自分类Dev

避免在使用预先安装的Ubuntu安装结束时出现“ Press Enter”消息

来自分类Dev

Haskell: How to capture keyboard press like up, down, left and right

来自分类Dev

Capturing Enter key on Android's onKeyDown

来自分类Dev

输入的Key.ENTER不提交

来自分类Dev

如何将Tab键转换为Web的Enter键?

来自分类Dev

如何将Tab键转换为Web的Enter键?

来自分类Dev

python pyglet on_mouse_press

来自分类Dev

不触发ObjectListItem“ press”事件

来自分类Dev

python pyglet on_mouse_press

来自分类Dev

WPF Key.Enter-它引入什么字符?

来自分类Dev

使用.split后,如何检查JTextArea中的enter key命令?

来自分类Dev

如何从ASPX中的条形码扫描检测ENTER KEY

来自分类Dev

On Key `Enter` 触发活动列表项 Angular 上的点击事件

来自分类Dev

通过 Enter Key 检测失去焦点 (Python-Kivy)

来自分类Dev

Detect long press on UIButton in iOS Simulator

来自分类Dev

Need AVPlayerView to exit fullscreen on esc button press

Related 相关文章

  1. 1

    GtkButton发出GDK_KEY_PRESS

  2. 2

    Matplotlib'key_press_event'不响应

  3. 3

    Vim exit Insert mode with some key press

  4. 4

    on_key_press()事件阻止on_mouse_press()和on_mouse_motion()事件持续1秒

  5. 5

    InputMap - register a keystroke that monitors key press, and no virtual repeats

  6. 6

    PyAutoGUI Key Press在Linux Ubuntu中性能降低

  7. 7

    如何将参数传递给fig.canvas.mpl_connect('key_press_event',on_key)中的on_key?

  8. 8

    How to prevent the Enter key to submit form

  9. 9

    使用key_press_event为不同类型的pick_event选择一个“模式”

  10. 10

    使用key_press_event为不同类型的pick_event选择一个“模式”

  11. 11

    Vim的“ Press Enter”提示符下的映射键

  12. 12

    为什么对字符串使用“ \ t”而不是“ <press TAB>”?

  13. 13

    Angular2 make textarea press enter without new line added

  14. 14

    避免在使用预先安装的Ubuntu安装结束时出现“ Press Enter”消息

  15. 15

    Haskell: How to capture keyboard press like up, down, left and right

  16. 16

    Capturing Enter key on Android's onKeyDown

  17. 17

    输入的Key.ENTER不提交

  18. 18

    如何将Tab键转换为Web的Enter键?

  19. 19

    如何将Tab键转换为Web的Enter键?

  20. 20

    python pyglet on_mouse_press

  21. 21

    不触发ObjectListItem“ press”事件

  22. 22

    python pyglet on_mouse_press

  23. 23

    WPF Key.Enter-它引入什么字符?

  24. 24

    使用.split后,如何检查JTextArea中的enter key命令?

  25. 25

    如何从ASPX中的条形码扫描检测ENTER KEY

  26. 26

    On Key `Enter` 触发活动列表项 Angular 上的点击事件

  27. 27

    通过 Enter Key 检测失去焦点 (Python-Kivy)

  28. 28

    Detect long press on UIButton in iOS Simulator

  29. 29

    Need AVPlayerView to exit fullscreen on esc button press

热门标签

归档