Friday, 29 July 2016

Jquery ui datepicker show month and year only on same page


// HTML

// only month and year
  <input name="month" id="datMonthYearFrom" />

// All

  <input name="month1" id="datMonthYearTo" />

// JS

$(function () {
     $("#datMonthYearFrom").datepicker({
                        changeMonth: true,
                        changeYear: true,
                        showButtonPanel: true,
                        dateFormat: "MM yy",
                        onClose: function (dateText, inst) {
                            $(this).datepicker('setDate', new Date(inst.selectedYear, inst.selectedMonth, 1));
                        }

                    }).focus(function () {
                        var thisCalendar = $(this);
                        $('.ui-datepicker-calendar').detach();
                    });           






////////////////////////////////////////// Second


$("#datMonthYearTo").datepicker({
                        changeMonth: true,
                        changeYear: true,
                        showButtonPanel: true,
                        dateFormat: "MM yy",
                        onClose: function (dateText, inst) {
                            $(this).datepicker('setDate', new Date(inst.selectedYear, inst.selectedMonth, 1));
                        }
                    });


});




No comments:

Post a Comment

How to highlight selected text in notepad++

  –> To highlight a block of code in Notepad++, please do the following steps step-1  :- Select the required text. step-2  :- Right click...