ready and submitted | SoloLearn: Learn to code for FREE!

0

ready and submitted

I successfully use $(function () when I need the code to be executed when the page is loaded, but what should I use if I need to execute the same code also every time the form (contained in that page) is submitted?

6/11/2019 10:10:39 AM

Vittorio Re

1 Answer

New Answer

+13

Use onsubmit attribute in <form> tag. Eg- In HTML- <form onsubmit="someFunction()" > ... </form> In JS- function someFunction() { // do something... }