Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
58
rated 0 times [  60] [ 2]  / answers: 1 / hits: 152565  / 15 Years ago, mon, november 30, 2009, 12:00:00

I am looking for the neatest way to create an HTML form which does not have a submit button. That itself is easy enough, but I also need to stop the form from reloading itself when submission-like things are done (for example, hitting Enter in a text field).


More From » html

 Answers
35

Add an onsubmit handler to the form (either via plain js or jquery $().submit(fn)), and return false unless your specific conditions are met.



Unless you don't want the form to submit, ever - in which case, why not just leave out the 'action' attribute on the form element?


[#98197] Wednesday, November 25, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
malkajillc

Total Points: 652
Total Questions: 107
Total Answers: 98

Location: Finland
Member since Sat, Nov 6, 2021
3 Years ago
malkajillc questions
;