Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery datepicker years change

I am using datepicker of jquery for a field to set date of birth, while default picker is displayed which gives option to scroll to date monthly and sounds tedious. Is there a way by which I can change years directly rather using months to change the year in turn.

like image 886
Sankalp Avatar asked Sep 12 '11 13:09

Sankalp


People also ask

How can change date format in jQuery ui datepicker?

inside the jQuery script code just paste the code. $( ". selector" ). datepicker({ dateFormat: 'yy-mm-dd' });

How do I change date format in date picker?

Do one of the following: For a text box control or a date picker control, ensure that the Data type list displays the appropriate data type, and then click Format. For an expression box control, ensure that the Format as list displays the appropriate data type, and then click Format.


1 Answers

There's a changeYear property on the datepicker that you can set to true.

$( ".selector" ).datepicker({ changeYear: true }); 

http://jqueryui.com/datepicker/#dropdown-month-year

This will render a select list from which you can choose the year you'd like.

like image 107
Jamie Dixon Avatar answered Nov 10 '22 12:11

Jamie Dixon