Reputation: 16340
I am doing client side validation for entered date so what and all string operation jquery allows?
Upvotes: 0
Views: 857
Reputation: 1087
Can do a simple javascript but I myself like jquery and regular expressions
var date_regex = /^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d$/;
$('form').submit(function(){
if( $('input.text').val().match(date_regex) == null){
return false;
}
return true;
});
and this code date format mm/dd/yyyy
Upvotes: 1
Reputation: 17598
jQuery is a javascript library which handles a number of things; string manipulation is not one of them. There are plenty of regular javascript string handling functions.
For an overview of the available javascript string functions, take a look at
http://www.w3schools.com/jsref/jsref_obj_string.asp
Upvotes: 2