From the course: JavaScript: Web Form Programming

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Challenge: Form validation

Challenge: Form validation

(electronic music) - [Instructor] All right, it's time for another programming challenge. Let's try a challenge using some of what we learned in this chapter. So I'll demonstrate the finished challenge, and then you can spend some time working on your own solution. So here in the browser, I have a simple form with a text area and a file chooser control. Now, the text area has a maximum length constraint applied. So if we go into the code and we scroll down, you can see here that here's my text area, and it has a max length of 100. And what we want to do is give the user a visual indicator that they are approaching the maximum character limit as they're typing. So let's go back to the browser, and you can see that as I'm typing along that when I get within about 50 characters of the limit, the text area turns yellow. So if I keep on typing, then if I get within 20 characters of the limit, the background turns red.…

Contents