JQuery UI Datepicker时间控件的基本用法

绑定

$("#iptStartDate" ).datepicker({
            showButtonPanel:true,
            showOn: "button",
            buttonImage: "common/easyUI/themes/black/images/datebox_arrow.png",
            buttonImageOnly: true
        });

绑定中设置了按钮图片,并且只有点击按钮图片之后才会弹出时间控件,如果要设置输入框和按钮图片保持高度和宽度,使用如下代码:

.divStartTime .divStartDate input[type="text"]
{
    float: left;
    width: 140px;
    height: 16px;
    border : 0;
    cursor: pointer;
    padding-left: 2px;
    margin-top: -1px;
}

这里写图片描述

操作

1、设置时间

$('#iptStartDate').datepicker('setDate', new Date());

2、获取时间

    var strStartDate = $('#iptStartDate').datepicker({ dateFormat: 'yy-mm-dd' }).val();

注好运

猜你喜欢

转载自blog.csdn.net/m0_37120609/article/details/72158102
今日推荐