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
Earlier, I challenged you to move list items to a saved state when the save button was clicked. In this video, I'll show you one solution to this challenge.
This video doesn't have any notes.
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
Now I'll show you how I
solved this challenge.
0:00
First though let's think
through the problem.
0:00
Remember when I talked about reversing
the edit state to get to the saved state?
0:03
To get to the edit state we exchanged
the span element with an input element and
0:08
we also changed the edit
button to read save.
0:13
And to get back we need to reverse those
changes, taking the end put out and
0:16
putting a span in.
0:21
And we also need to change
the save button to read edit.
0:22
So just like we did for the edit state,
0:26
we'll first add a branch to the else
if statement here in the click handler.
0:28
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