-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
jQuery 2.0 Development Cookbook
By :
Dates are common items of data, and it is important that the user be able to easily input a date into your web form. Typically, you would use a date picker that has date validation included to provide an easy input method. This recipe shows you how to manually validate a date in the UK format (that is, DD/MM/YYYY). Date pickers are covered in Chapter 9, jQuery UI, using the popular jQuery UI framework. Refer to the See also section of this recipe for more information.
Continuing the trend of the previous recipes of this chapter, ensure that you have validation.js open and ready for modification and that you have completed the previous three recipes.
Add date validation to your web form by performing the following simple steps:
Update validation.js to add the additional date validation function and class check within the main for loop, shown as follows:
$(function(){
$('.submit-btn').click(function(event){
// -- JavaScript from previous...
Change the font size
Change margin width
Change background colour