- View Offline
- Understanding forms
- Adding required fields and placeholders
- Accepting multiple entries
- Limiting uploads
- Handling focus changes
- Validating with regular expressions
- Working with older browsers
- Building jQuery validation
- Using server-side validation
- Sanitizing form input
- Uploading files
- Sending form data to a database
Skill Level Intermediate
We're just using the current version, so this will be fine. So, I'm going to copy this, and I'll go into my code, and I'll put it right after the modernizer script. So, I'm going to save that, I'm going to go to the page for this code, and I'll refresh it and right click and select Inspect Element. Now from here, I want to go over to the console. Now to select a form element I just checked, the jQuery dollar global and I pass it along a string with whatever I want to choose. So if I want to choose my form, I'll just put # sign, MyForm and hit Return and that selects the entire form. If I want just the input fields in MyForm, I can add the pseudoclass selector input.
The difference is that choosing an element in this way will work in older version of IE consistently without needing modernizer. Let's say you wanted to get information about a specific field. Since our form fields have ID values, it's easy to select them. You can also choose an item's attribute with the type selector. Let's say we wanted to get pattern in the input field with the ID of my name. You can also get just the text of the pattern attribute or ATTR method.
Sign up for a Premium Membership to download courses for Internet-free viewing.
Watch offline with your iOS, Android, or desktop app.Start Your Free Trial
After signing up, download the course here or from the iOS/Android App.