2024/03/07 초기화 기능 수정

This commit is contained in:
kmg 2024-03-07 18:24:26 +09:00
parent d505b57e4b
commit 27a5879ad2
2 changed files with 31 additions and 14 deletions

View File

@ -64,23 +64,22 @@
form.action = "<c:url value='/kccadr/oprtn/adultVisitEdu/instrActvtHstryMngDetail.do'/>";
form.submit();
}
//초기화
function fncReset(thisObj){
var targetObj = $(thisObj).closest('.list_top').find('select,input');
$.each(targetObj, function(){
if($(this).prop('tagName') == 'SELECT'){
if($(this).attr('name').indexOf('Month') != -1){
$(this).val(new Date().getMonth()+1);
}else if($(this).attr('name').indexOf('Year') != -1){
$(this).val(new Date().getFullYear());
}else{
$(this).prop("selectedIndex", 0);
}
}else{
if ($(this).prop("tagName") == 'SELECT') {
// 초기화 시 무조건 select option 첫번째 지정
$(this).find("option:first-child").prop("selected",true);
} else if ($(this).attr('type') == 'radio') {
var radioName = $(this).attr("name");
var radioFirst = $("[name="+radioName+"]")[0];
$(radioFirst).prop("checked",true)
} else {
$(this).val('');
}
});
}
});
}
</script>
<title>강사활동확인서신청관리</title>
</head>

View File

@ -71,7 +71,7 @@
listForm.submit();
}
function fncReset(thisObj){
/*function fncReset(thisObj){
var targetObj = $(thisObj).closest('.list_top').find('select,input');
$.each(targetObj, function(){
if($(this).prop('tagName') == 'SELECT'){
@ -90,7 +90,25 @@
}
}
});
}
}*/
// 캘린더 및 라디오, 체크박스까지 초기화
function fncReset(thisObj){
var targetObj = $(thisObj).closest('.list_top').find('select,input');
$.each(targetObj, function(){
if ($(this).prop("tagName") == 'SELECT') {
// 초기화 시 무조건 select option 첫번째 지정
$(this).find("option:first-child").prop("selected",true)
} else if ($(this).attr('type') == 'radio') {
$(this).prop('checked',true);
} else if ($(this).attr('type') == 'checkbox') {
$(this).prop('checked',false);
} else {
$(this).val('');
}
});
}
function fnCheckAll(){
var chk = document.listForm.chk;