The 'submit' event on forms in JavaScript

preview_player
Показать описание
You can use the "submit" event in JavaScript to react to when the user submits an HTML form. This can be useful when you want to use AJAX for your form processing.

In this video I take you through a quick example of how to use the "submit" event - which includes the use of AJAX to submit a form.

Support me on Patreon:

For your reference, check this out:

Follow me on Twitter @dcode!

If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!

#dcode #javascript #webdev
Рекомендации по теме
Комментарии
Автор

Sometimes you can get stumped by the simplest of issues, and its sooo annoying looking for hours and every tut you watch doesn't seem to give what you KNOW is a simple answer to a simple problem. Your basic method just works! Thanks fella!!! Hope the lockdown isnt driving you nuts lol 👍

coffeeandvapes
Автор

Thank you very much for this little tutorial. I tried to find a video like this for too long. I wish you good luck, man

SemyonTishchenko
Автор

exactly what I was looking for, good stuff

Dreku
Автор

i liked your video, because you deserve this. what your content in this video is the thing i don't find any where in the web

gamenesting
Автор

thank you so much sir, you know you remove one of my difficulties .

thantzinwin
Автор

Nice answer to a simple question. Thanks!

larskra
Автор

damn the quality of this video! fkn subscribed !!!!

bumbledoge
Автор

thanks a lot, hope you get an enormous success in this field

abdullahmanafikhi
Автор

Thank you so so much bro 🙏 u helped me a lot bro . Good stuff 👍 keep up

tarunchelumalla
Автор

thank you for your explaining, really amazing

athraafaraj
Автор

For my assignment, I got the error code on the first step, saying it cannot add read property of addEventListener of null... My teacher isn't the greatest at explaining and I feel lost in the course. Do you think you can point me in the right direction to deal with this problem? Thanks

JunkMailBand
Автор

How do you get FormData working with just JavaScript? I want to code in Node JS.
When I pop the new FormData(myForm) in the parameter of a console.log, I get some obscure data that isn't helpful.

Barnardrab
Автор

Anyone else getting 405 error method not allowed? How to fix @dcode

trytoo
Автор

Thank you, I had a question
By taking multiple inputs in FORM like name, age, number, after clicking on submit it will appear on new page with name:xyz, number:123456. with edit option also can we make like this with only using java script. please make a video on this.
thank you

nagendra
Автор

I have a question, if i wanna to but counter of users submit the course for example, how can i do it? and what can I write to search about this task?

athraafaraj
Автор

This works great..., but if I have multiple forms on a page how can I add event listeners to all forms? Say adding a Ajax-form class to all forms I want to add a listener to and then looping through them to add a listener to each one. Sounds simple, but when I try it my forms stop posting on submit.

Stallion
Автор

Hello there,
Wy am I getting a TypeError: myForm is null?
The code is:
const myForm =
myForm.addEventListener("submit", (e) => {
e.preventDefault();
console.log("Form is submitted");
});
Of course, the form has id myForm in html.
I am doing a radio form type, but that souldn't be the problem.
Thanks!

milofcrsdelije
Автор

We have JS code that fires on our thank you page, that we would like moved to our submit button on our form. so how we can do that

Chetanjul
Автор

hi, I am looking for building a simple homepage, where I have a simple searchbox for google.
how to implement that in a html ? I know basic html and I know how to make a inputbox but how do I redirect the input text into google searchbar? So it has to go essentially to Google.com

confidential
Автор

I followed this video EXACTLY. I get this error and i don't know what to do... Uncaught TypeError: Cannot read properties of null (reading 'addEventListener') ..., (e) => {}); " This line is where the error is ?!

ajwadmajed