-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjquery.validation.functions.js
executable file
·37 lines (37 loc) · 1.1 KB
/
jquery.validation.functions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* @author GeekTantra
* @date 24 September 2009
*/
/*
* This functions checks where an entered date is valid or not.
* It also works for leap year feb 29ths.
* @year: The Year entered in a date
* @month: The Month entered in a date
* @day: The Day entered in a date
*/
function isValidDate(year, month, day){
var date = new Date(year, (month - 1), day);
var DateYear = date.getFullYear();
var DateMonth = date.getMonth();
var DateDay = date.getDate();
if (DateYear == year && DateMonth == (month - 1) && DateDay == day)
return true;
else
return false;
}
/*
* This function checks if there is at-least one element checked in a group of check-boxes or radio buttons.
* @id: The ID of the check-box or radio-button group
*/
function isChecked(id){
var ReturnVal = false;
$("#" + id).find('input[type="radio"]').each(function(){
if ($(this).is(":checked"))
ReturnVal = true;
});
$("#" + id).find('input[type="checkbox"]').each(function(){
if ($(this).is(":checked"))
ReturnVal = true;
});
return ReturnVal;
}