Here’s a simple jQuery Datepicker example.
CODE:
In above example,date formate id mm/dd/yy but you change it to (‘dd-mm-yy’) by changing code:
OR prevent users from selecting weekends ..

OR how to disable all the future dates….
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| <head><title>Ashish's blog -Datepicker</title><link type="text/css" rel="Stylesheet" href="http://ajax.microsoft.com/ajax/jquery.ui/1.8.6/themes/smoothness/jquery-ui.css" /><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" ></script><script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.ui/1.8.6/jquery-ui.min.js" ></script><script type="text/javascript">$(function () {$("#date").datepicker();});</script></head><body><input id="date" type="text" /></body></html> |
1
2
3
4
5
6
7
8
| <script type="text/javascript">$(document).ready(function () {$(function () {// $("#txtInvoiceDate").date_input();$("#date").datepicker({ dateFormat: 'dd-mm-yy' });});});</script> |
1
2
3
4
5
6
7
| <script type="text/javascript">$(function () {$("#datepic").datepicker({beforeShowDay: $.datepicker.noWeekends});});</script> |
1
2
3
4
5
6
7
8
9
10
11
12
13
| <script type="text/javascript"> $(function () { var date = new Date(); var currentMonth = date.getMonth(); var currentDate = date.getDate(); var currentYear = date.getFullYear(); $("#datepic").datepicker({ maxDate: new Date(currentYear, currentMonth, currentDate) }); }); </script> |
No comments:
Post a Comment