时间范围

时间:2018-08-11 10:48:38

标签: javascript jquery timepicker

function _editableTime(elementId , index, elementName, val, mandatoryObj){
var timeElement = document.createElement("input");
timeElement.id = elementId;
$(timeElement).attr("placeholder" , "24hr Format Only");
checkReadOnly(timeElement);
var classNames = "form-control input-xs";

if(mandatoryObj && mandatoryObj[elementName]){
    classNames += " mandate";
    var mandateObj = mandatoryObj[elementName];

    if(mandateObj && mandateObj['alertMsg']){
        $(timeElement).attr("alert-message" , mandateObj['alertMsg']);
    }
}

$(timeElement).attr("class", classNames);

if(val){
    timeElement.value = val;

}

if(timeElement.addEventListener){
timeElement.addEventListener("focus",function() {return $(timeElement).timepicker({
     'step': 15,'timeFormat' : 'H:i','minTime': '06:00am'}).on('changeTime', function() {
            $(timeElement).timepicker('hide')});});
}else{
    timeElement.attachEvent("focus",function() {return $(timeElement).timepicker({
        'step': 15,'timeFormat' : 'H:i','minTime': '06:00am'}).on('changeTime', function() {
            $(timeElement).timepicker('hide')});});
}
return timeElement;

}

**如何将时间范围设置为清晨-凌晨5点-上午7点 早上-7am-12 下午-12-4pm 晚上-下午4点至晚上7点 晚上-晚上7点至晚上11点 深夜-11pm-5am **

0 个答案:

没有答案