From the course: JavaScript: Web Form Programming

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Solution: Dynamic forms

Solution: Dynamic forms

From the course: JavaScript: Web Form Programming

Start my 1-month free trial

Solution: Dynamic forms

(upbeat music) - [Instructor] Let's take a look at my solution to this particular coding challenge. And remember that there were three parts to this challenge. First was create a text input that can be cleared by Shift + Escape, create a date input field that can be initialized to today's date, and implement a feature where we build a list that combines the date and text into a list item, and puts it into the document alright. So let's open up the solution code. So, first, my script adds an EventListener right here, for the key down event, on this line here. So for the clearable text field, I'm listening for the key down event. And so I check to see if the Shift key is being held down. And, if the event code is equal to Escape, for the Escape key. If that's the case, then I log out that Shift + Escape is pressed, and I set the value to be the empty string. Right, so that's pretty straight forward. The second…

Contents