The time control only displays the year and month, and the time control displays the year and month.
<input id="db" />
Initialize and load the db tag.
$ (Function () {$ ('# db '). datebox ({onShowPanel: function () {// displays the selected object and then triggers the event at the month layer. No month layer span is generated during initialization. trigger ('click'); // trigger the click event to bring up the if (! Tds) setTimeout (function () {// time delay triggered to obtain the month object, because the above event trigger and object generation have time interval tds = p. find ('div. calendar-menu-month-inner td '); tds. click (function (e) {e. stopPropagation (); // disable bubbling. Execute the event var year =/\ d {4}/.exec(span.html () [0] // to get the year, month = parseInt ($ (this ). attr ('abbr '), 10); // month. You do not need to add more than 1 $ (' # db') here '). datebox ('hidemopanel ') // hides the date object. datebox ('setvalue', year + '-' + month); // set the date value}) ;}, 0); yearIpt. unbind (); // Unbind any events in the year input box}, parser: function (s) {if (! S) return new Date (); var arr = s. split ('-'); return new Date (parseInt (arr [0], 10), parseInt (arr [1], 10)-1, 1);}, formatter: function (d) {return d. getFullYear () + '-' + (d. getMonth () + 1) ;}}); var p =$ ('# db '). datebox ('panel '), // Date select object tds = false, // Date select object month yearept = p. find ('input. calendar-menu-year '), // year input box span = p. find ('span. calendar-text '); // display the trigger control of the month layer });
Click to display and obtain the value of only the year, left for the emergency.