jquery 时间选择

You can pass these options as key/value object to $.asDatepicker() method.

default single


<input type="text" id="calendar"> <script> $(document).ready(function(){ $("#calendar").asDatepicker(); }); <script>

range


<input type="text" id="calendar2"> <script> $(document).ready(function(){ $("#calendar2").asDatepicker({mode: 'range'}); }); <script>

multiple


<input type="text" id="calendar3"> <script> $(document).ready(function(){ $("#calendar3").asDatepicker({mode: 'multiple', calendars: '4'}); }); <script>

Data attributes

Any option of the asDatepicker can also be set via data-attributes.

Such as:


<input type="text" id="calendar4" data-mode="range" data-range-mode="section" data-selectable-year="2001>2010,2012,2014>2016"> <script> $(document).ready(function(){ $("#calendar4").asDatepicker(); }); <script>

Mobile Single


<input type="text" id="calendar-mobile-single"> <script> $(document).ready(function(){ $('#calendar-mobile-single').asDatepicker({ mobileMode: true }); }); <script> 

Mobile Range


<input type="text" id="calendar-mobile-range"> <script> $(document).ready(function(){ $('#calendar-mobile-range').asDatepicker({ mode: 'range', mobileMode: true }); }); <script> 

Mobile Multiple


<input type="text" id="calendar-mobile-multiple"> <script> $(document).ready(function(){ $('#calendar-mobile-multiple').asDatepicker({ mode: 'multiple', mobileMode: true }); }); <script> 

Keyboard navigation

left arrow ----- highlights previous day

right arrow ----- highlights next day

up arrow ----- highlights same day from the previous week

down arrow ----- highlights same day from the next week

ctrl + left arrow ----- navigates to previous month

ctrl + right arrow ----- navigates to next month

ctrl + up arrow ----- navigates to higher view

ctrl + down arrow ----- navigates to lower view

alt + left arrow ----- focus in previous calendar

alt + right arrow ----- focus in next calendar

enter ----- if in "days" view selects the highlighted day. In other views navigates to a lower view

esc ----- closes the popup

Available options

You can pass these options as key/value object to $.asDatepicker() method.

API

DisplayMode

With default dropdown and inline


$("#calendar-api-displayMode").asDatepicker({displayMode: 'inline'});

show()


$('#calendar-api-show').asDatepicker('show');

hide()


$('#calendar-api-show').asDatepicker('hide');

multipleClear()


$('#calendar-api-multipleClear').asDatepicker('multipleClear');
Clear

getWrap()


$.asDatepicker('getWrap');

Returns the wrapper of the calendar.

getInput()


$.asDatepicker('getInput');
Returns the input field.

getDate()


$('#calendar-api-getDate').asDatepicker('getDate');

Returns the currently selected date.

getDate
 

getDate(format)


$('#calendar-api-getDate-format').asDatepicker('getDate', 'yyyy-mm-dd');

Returns the current date, formatted with the pattern given as the argument.

getDate
 

update()


$('#calendar-api-update').asDatepicker();
$('#calendar-api-update').asDatepicker('update', {mode: 'range'});

Sets one or more options for the asDatepicker.

update

转载于:https://www.cnblogs.com/didiaodexiaodao/p/10205976.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值