1. If you use it this way, you need to add a <form></form> tag externally. You can activate submit by pressing Enter, and there is no need to write js.
2. If you don’t want to add a layer of <form></form> tags, then you can listen to the onclick event of the button.
Only form has submit event
Submit can only be triggered when it is written in the form. What he submitted is the form
1. If you use it this way, you need to add a <form></form> tag externally. You can activate submit by pressing Enter, and there is no need to write js.
2. If you don’t want to add a layer of <form></form> tags, then you can listen to the onclick event of the button.