标签:style io os ar for sp div art on
有这么个需求,datepicker默认是选某个具体的日子的,但是现在只选到年月为止,
solution:
html如下:
<div>
<label for="startDate">Date :</label>
<input name="startDate" id="startDate" class="date-picker" />
</div>
在datepicker中配置如下:
$(‘.date-picker‘).datepicker( { changeMonth: true, changeYear: true, showButtonPanel: true, dateFormat: ‘MM yy‘, 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)); } });
在style里添加这么一句:
.ui-datepicker-calendar {
display: none;
}
标签:style io os ar for sp div art on
原文地址:http://my.oschina.net/147258369/blog/322903