Home >Web Front-end >HTML Tutorial >How to position the focus on the linkbutton by pressing Enter in the input? _html/css_WEB-ITnose

How to position the focus on the linkbutton by pressing Enter in the input? _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:45:361284browse

The code is as follows:
$( '#password').textbox('textbox' ).keydown(function (e) {
if (e.keyCode == 13) {
$( " #login").linkbutton('linkbutton' ).focus();
                                                                             

                                                                      🎜>                                                                                                   form>                                                                        ;/td>

                                                                                                                                         td>

                                                                                                                 gt;                                                                          usernameObj = document.getElementById("username");
usernameObj.onkeydown = function(event) {

e = event ? event:(window.event ? window.event : null);

// Press When the Enter key is pressed and the input box value is not empty,

if(e.keyCode==13 && usernameObj.value){
document.getElementById("password").focus();
} }
}  
                                                                                                      🎜> $( "#login").linkbutton('linkbutton' ) returns not a jquery object

I guess it should be like this: $( "#login").focus()

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn