I see on many sites that the enter key will submit a form but you could also click on the button to submit. Is there a trick to this? Or can a button have two different types of functions attached?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
My dear there is nothing tricky. Just put the type of the button as
submitand your will achieve what you are wanting. See ThisAfter UPDATE
When there is a
formtag in your html page, enter button always submit the form. If you have made your own button havingtype="button"even then you can submit form onclick it.and here is your javascript function
Hence your both cases can be achieved