From the course: JavaScript: Web Form Programming

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Using CSS to enhance dynamic validation

Using CSS to enhance dynamic validation

From the course: JavaScript: Web Form Programming

Using CSS to enhance dynamic validation

- [Instructor] In addition to specifying various input constraints, to help the user enter valid data, there are some CSS features that you can use to visually indicate to the user that form fields are required or invalid, or contain valid information. Let's go ahead and open up the CSS validation start file. And we're going to continue using the Stock Purchase example to demonstrate these CSS features. All right, let's go ahead and bring this up in the browser. So, first let's see how we can apply a style to a required input field. So CSS gives us a pseudo class that we can apply to required elements. So let's indicate that a field is required by giving it a thick, blue, left border. So let's go back to the code, and inside my style section here, I'm going to define a style rule for input, and then I'm going to use the required pseudo class. And I'll specify that border left, right? Should be a .3em solid blue. All…

Contents