How to set pre default current date in datebox before choose any other new date:
We have to follow following steps.
Step 1:-
Download below 2 files.
- jquery.datepick.js
- jquery.datepick.css
Call both file in HTML head
<link type="text/css" href="jquery.datepick.css" rel="stylesheet">
<script type="text/javascript" src="jquery.datepick.js"></script>
Step 2:-
Call below java script function on run time:-
<script type="text/javascript"
$(function(){
$('.datePicker').datepick();
var myDate = new Date();
var prettyDate =(myDate.getMonth()+1) + '/' + myDate.getDate() + '/' +
myDate.getFullYear();
$(".datePicker").val(prettyDate);
});
</script>
Step 3:-
Add input text box in HTML code where display calendar.
<input type="text" class="datePicker">
0 Comment(s)