Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed DOM Scripting By Example!
You have completed DOM Scripting By Example!
Preview
The first feature we'll work on is name registration. We'll harness the default browser behavior for forms to get two handlers for the price of one, using the submit event.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
I program that, make sure it works,
and move to the next task.
0:00
So what's the first thing we can do here?
0:02
Well let's start by capturing
the input from the form field.
0:04
Then we can print it to the console.
0:07
Let's take a quick look at index.html and
we know that the form's ID is registrar.
0:09
So we can select the form by its ID
0:15
then get a hold of the input
child element from there.
0:18
Now you might be tempted
to set a click handler
0:21
on the submit button to respond
to the user submission.
0:24
But you can submit
a form in multiple ways.
0:27
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up