Example :
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$(function() {
$( "#my_date" ).datepicker({
dateFormat: "MM/dd/yy",
defaultDate: "January/01/1970",
minDate: "January/01/1925",
maxDate: "December/31/2011",
changeMonth: true,
changeYear: true,
yearRange: "1925:2011",
onClose: function(dateText, inst) {
var validDate = $.datepicker.formatDate( "MM/dd/yy", $('#my_date').datepicker('getDate'));
$('#my_date').datepicker('setDate', validDate);
}
});
});
</script>
</head>
<body>
<input name="my_date" id="my_date" type="text" value="January/01/1970" />
</body>
</html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$(function() {
$( "#my_date" ).datepicker({
dateFormat: "MM/dd/yy",
defaultDate: "January/01/1970",
minDate: "January/01/1925",
maxDate: "December/31/2011",
changeMonth: true,
changeYear: true,
yearRange: "1925:2011",
onClose: function(dateText, inst) {
var validDate = $.datepicker.formatDate( "MM/dd/yy", $('#my_date').datepicker('getDate'));
$('#my_date').datepicker('setDate', validDate);
}
});
});
</script>
</head>
<body>
<input name="my_date" id="my_date" type="text" value="January/01/1970" />
</body>
</html>
0 Comments:
Post a Comment