Monday, 15 September 2014

javascript - jQuery UI DatePicker for month and year selection is not working -


I'm using jquery datepicker as a month picture and it's working but the only problem is that if When I select one month from the calendar, it shows that in the input field that month, but when I click on that input field again, it does not show the selected month, but it shows the current month.

HTML

  & lt; = "Start Date" & gt; Date: & lt; / Label & gt; Labels for & Lt; Input name = "start date" id = "start date" class = "date-picker" /> $ {Function () ($ ('dead-picker'). Dadepicor ({changeMonth: true, changeYear: true, showButtonPanel: correct, date format: 'mm yy', but off: function (date text, inst) { Function handonpress () {return ($ ('# ui-datepicker-div') .html () IndexOf ('ui-datepicker- close Ui-state-default-ui-priority primary ui-corner-all ui-state- Hover ')> 1};} if (HadonPresence ()) {var month = $ ("# ui-datepicker-div .ui VAT:): $ (this) .depakkar (' set date ', new date (Year, month, 1)); console.log ('full pressed')}}}};});  

Here's my question for

You have to change first, show as below and even after the months name is in the string, you have to do the number of maps against the number is an array like this

"Month", "june", "june", "august", "September", "October", "month", " "Nov", "Dec"]; First Show: Function (Input, Inst.) {Inst.dpDiv.addClass ('month_year_datepicker') if ((datestr = $ (this) .val ()). Length & gt; 0) {datestr = datestr.split (""); Year = dated [1]; Month = month name.indexoff (datastars [0]); $ (This) .Datrickker ('option', 'default date', new date (year, month, 1)); $ (This) .Det Picker ('Set Date', New Date (Year, Month, 1)); . Hide $ (".Ui-datepicker-calendar"); }}

is

or you can use this great looking method to change the number in the month

  function getMonthFromString (mon) {return new date (date. From (Mon + "1, 2012"). GetMonth () + 1}  

Courtesy:

here


No comments:

Post a Comment