jquery year picker

Solutions on MaxInterview for jquery year picker by the best coders in the world

showing results for - "jquery year picker"
Percy
13 Jul 2017
1//JQuery year picker:
2
3HTML
4
5<label for="startYear"> Start Year: </label>
6  <input name="startYear" id="startYear" class="date-picker-year" />   
7jQuery
8
9 <script type="text/javascript">
10        $(function() {
11            $('.date-picker-year').datepicker({
12                changeYear: true,
13                showButtonPanel: true,
14                dateFormat: 'yy',
15                onClose: function(dateText, inst) { 
16                    var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
17                    $(this).datepicker('setDate', new Date(year, 1));
18                }
19            });
20        $(".date-picker-year").focus(function () {
21                $(".ui-datepicker-month").hide();
22            });
23        });
24
25</script>