Go Pro Sign Up Login
0 days 0 hrs 0 min 0 sec

Summer Sale

50% off Level Up Pro until you unsubscribe.
Get access to ALL 128 courses on Level Up Tutorials

This is your last chance to get Level Up Pro for $145/year.

or Learn More
Moon Moon

Buy Now and unlock this series

$

49

.99

$

29

.99

yours forever

Become a Pro and unlock everything

$

24

.99

per month

Forms with VanillaJS

Now we will dive into registration. We will talk about the correct way to set up a form in JS and log the information we get on form submission.

Downloads

Become a pro to download code and videos

Comments

Eben

4 months ago

Just use the FormData interface to get form values. It's smart enough to ignore the button element.

const values = Object.fromEntries( new FormData( form ).entries() );

https://developer.mozilla.org/en-US/docs/Web/API/FormData

Hartwig

about 1 year ago

Upgrade: the intention was to use fetch for the request creation - the server code will have the configured route and the data is inserted via the fetch object of the fetch api.

Hartwig

about 1 year ago

not quite clear here (at this point in time why not some script.js and a src ='path to the script.js'

Want to join the conversation?

Become a Pro member today!