隨手記錄一下
jqueryui Datepicker
隱藏日期、年、月選單
$(".ui-datepicker-calendar").hide(); //隱藏日期選單
$(".ui-datepicker-month").hide(); //隱藏月選單
$(".ui-datepicker-year").hide(); //隱藏年選單
舉例來說不要出現日期選單(僅出現年月)
<div>
<input type="text" id="yearmonth" name="yearmonth" class="yearmonth">
</div>
<script>
$('#yearmonth').datepicker({
changeMonth: true,
changeYear: true,
showButtonPanel: true,
dateFormat: 'yymm',
onClose: function (dateText, inst) {
var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
$(this).datepicker('setDate', new Date(year, month, 1));
},
beforeShow: function () {
setTimeout(function () {
$('.ui-datepicker').css('z-index', 99999999999999);
}, 0);
}
});
$(".yearmonth").focus(function () {
$(".ui-datepicker-calendar").hide();
});
<script>
以上內容,若有錯誤
煩請各路高手路過指正
謝謝!
<(_ _)>