Jquery select NEXT text field on Enter Key Press

后端 未结 6 1466
感动是毒
感动是毒 2020-12-31 15:31

I have made a page using jquery, and on load it selects the first text field automatically. I want it to then move to the next field when the ENTER key is pressed.



        
6条回答
  •  没有蜡笔的小新
    2020-12-31 15:45

    I've created a little function which can do what you need. This is the version I use so you may need to change the class names but you should get the idea.

    
    

    So basically:-

    • Get all the input fields matching .vertical
    • Find which is the current text box
    • Find the next one
    • Set the focus on that one

提交回复
热议问题