|
|
|
@ -3,39 +3,46 @@ function initDatepicker(elementId){
|
|
|
|
|
var executionArea = $("#"+elementId);
|
|
|
|
|
|
|
|
|
|
/*--------------------- 달력 제어 ---------------------*/
|
|
|
|
|
executionArea.find(".form-date").datepicker()
|
|
|
|
|
.attr("maxlength", "10")
|
|
|
|
|
.on("input",function(e){
|
|
|
|
|
|
|
|
|
|
if(this.value.length <= 0){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(this.value.length != this.selectionStart){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var value = this.value.replaceAll("-","");
|
|
|
|
|
|
|
|
|
|
if(value.length > 7){
|
|
|
|
|
this.value = value.substring(0,4)+"-"+value.substring(4,6)+"-"+value.substring(6);
|
|
|
|
|
} else if(value.length > 5){
|
|
|
|
|
this.value = value.substring(0,4)+"-"+value.substring(4);
|
|
|
|
|
executionArea.find(".form-date").each(function(){
|
|
|
|
|
|
|
|
|
|
$(this)
|
|
|
|
|
.datepicker()
|
|
|
|
|
.attr("maxlength", "10")
|
|
|
|
|
.on("input",function(e){
|
|
|
|
|
|
|
|
|
|
if(this.value.length <= 0){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(this.value.length != this.selectionStart){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var value = this.value.replaceAll("-","");
|
|
|
|
|
|
|
|
|
|
if(value.length > 7){
|
|
|
|
|
this.value = value.substring(0,4)+"-"+value.substring(4,6)+"-"+value.substring(6);
|
|
|
|
|
} else if(value.length > 5){
|
|
|
|
|
this.value = value.substring(0,4)+"-"+value.substring(4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
.on("paste", function(e){
|
|
|
|
|
|
|
|
|
|
var value = e.originalEvent.clipboardData.getData('text');
|
|
|
|
|
if(value.length == 8){
|
|
|
|
|
this.value = value.substring(0,4)+"-"+value.substring(4,6)+"-"+value.substring(6);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
var calendarIcon = $(this).next("button.bx-calendar");
|
|
|
|
|
if(calendarIcon.length > 0){
|
|
|
|
|
$(calendarIcon).on("click", function() {
|
|
|
|
|
$(this).prev().focus();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
.on("paste", function(e){
|
|
|
|
|
|
|
|
|
|
var value = e.originalEvent.clipboardData.getData('text');
|
|
|
|
|
if(value.length == 8){
|
|
|
|
|
this.value = value.substring(0,4)+"-"+value.substring(4,6)+"-"+value.substring(6);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
executionArea.find(".form-date").next("button.bx-calendar").on("click", function() {
|
|
|
|
|
$(this).prev().focus();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|