Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
143
rated 0 times [  145] [ 2]  / answers: 1 / hits: 59196  / 13 Years ago, tue, november 15, 2011, 12:00:00

There are a few similar questions to this but none quite the same.



I want to know if there is an event that can be used to execute some JS before a page is submitting (i.e. POSTed).


More From » javascript

 Answers
72

If you are working with the form, you can use onsubmit event.



Using jQuery you can do that with



$('#myform').submit(function() {
// your code here
});

[#89118] Sunday, November 13, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
analiseb

Total Points: 252
Total Questions: 96
Total Answers: 106

Location: Singapore
Member since Sat, Jul 25, 2020
4 Years ago
analiseb questions
;