The form submit button works by clicking on the form submit button:
<button id="formBtn" onClick={submitForm(onFormSubmit)} >
Then I was trying to use "Enter" key to trigger that "submitForm" function by adding the code below in one text input in my form in TailwindCSS.
In the browser console I could only see log1, but both "submitForm" and "onFormSubmit" functions were not triggered. Why?
<input
onInput={handleInput}
onkeypress={(e)=>{
if(e.key === "Enter" && !e.shiftKey) {
console.log("log1:Enter detected")
submitForm(onFormSubmit)
}
}}
/>