Keydown and click call the same method, keydown does not take effect?

In the

project,
keydown judges that if it is the enter key, the function is called to perform the search.
click is a direct click to search, but
but keydown is not effective. Which god can solve the problem?
all the functions executed are the same function. It won"t work if I call the function directly, but I can use it if I put the contents of the function into keydown.

May.26,2021

guess that Enter triggered the submit, of the form

if there is only one single line input, in a form, the form will be submitted at the same time as the enter

W3
clipboard.png

Enter keydown(formaction)

keydowndemo

formonsubmitreturn false


Menu