How to trigger HTML button when you press Enter in textbox?

后端 未结 12 1286
悲哀的现实
悲哀的现实 2020-12-04 08:13

So the code that I have so far is:

&
12条回答
  •  一个人的身影
    2020-12-04 09:02

    First of all add jquery library file jquery and call it in your html head.

    and then Use jquery based code...

    $("#id_of_textbox").keyup(function(event){
        if(event.keyCode == 13){
            $("#id_of_button").click();
        }
    });
    

提交回复
热议问题