Run Jquery method when enter key is pressed

后端 未结 4 675
自闭症患者
自闭症患者 2021-01-14 02:09

I\'m trying to run a method when the enter key has been pressed. This method is already being used by a button. Basically, when the user fills in a text field and clicks a s

4条回答
  •  既然无缘
    2021-01-14 02:39

    $(".input_loginform").keypress(function(e){
        if (e.which == 13){
            e.preventDefault();
            alert("User pressed 'Enter' in a text input. sender form #"+this.form.id);
            postlogin("#"+this.form.id);
        }
    });
    

提交回复
热议问题