I have a date picker that enters the selected date inside the textbox. I need to make sure of the following before I save the date:
Make sure the field is not empty
Make sure the date is in YYYY-MM-DD format (ready to store in mysql date type column)
Make sure the date is at least 18yrs ago
//Last Name var input= $("#last_name"); var last_name = input.val(); if(last_name != "" && validate_letters_only(last_name)){ fd.append('last_name', last_name); input.removeClass("invalid").addClass("valid"); }else{ input.removeClass("valid").addClass("invalid"); } // Birthday fd.append('birthdate', $("#birthday").val());