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

This commit is contained in:
kmg 2024-03-07 17:47:05 +09:00
parent 1467f69802
commit 9d582c2691
7 changed files with 103 additions and 56 deletions

View File

@ -168,6 +168,22 @@
}); });
} }
//초기화
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') {
var radioName = $(this).attr("name");
var radioFirst = $("[name="+radioName+"]")[0];
$(radioFirst).prop("checked",true)
} else {
$(this).val('');
}
});
}
</script> </script>
<title>과정신청기간관리목록</title> <title>과정신청기간관리목록</title>

View File

@ -181,24 +181,19 @@
} }
//초기화 //초기화
function fncReset(thisObj) { function fncReset(thisObj){
var targetObj = $(thisObj).closest('.list_top').find('select,input'); var targetObj = $(thisObj).closest('.list_top').find('select,input');
$.each(targetObj, function() { $.each(targetObj, function(){
if ($(this).prop('tagName') == 'SELECT') { if ($(this).prop("tagName") == 'SELECT') {
if ($(this).attr('name').indexOf('Month') != -1) { // 초기화 시 무조건 select option 첫번째 지정
$(this).val(new Date().getMonth() + 1); $(this).find("option:first-child").prop("selected",true);
} else if ($(this).attr('name').indexOf('Year') != -1) { } else if ($(this).attr('type') == 'radio') {
$(this).val(new Date().getFullYear()); var radioName = $(this).attr("name");
} else { var radioFirst = $("[name="+radioName+"]")[0];
$(this).prop("selectedIndex", 0); $(radioFirst).prop("checked",true)
}
} else {
if ($(this).attr('type') == 'checkbox') {
$(this).prop('checked', false);
} else { } else {
$(this).val(''); $(this).val('');
} }
}
}); });
} }

View File

@ -144,6 +144,22 @@
}); });
} }
//초기화
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') {
var radioName = $(this).attr("name");
var radioFirst = $("[name="+radioName+"]")[0];
$(radioFirst).prop("checked",true)
} else {
$(this).val('');
}
});
}
</script> </script>
<title>교육과정관리</title> <title>교육과정관리</title>

View File

@ -100,7 +100,22 @@
event.stopImmediatePropagation(); event.stopImmediatePropagation();
} */ } */
//초기화
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') {
var radioName = $(this).attr("name");
var radioFirst = $("[name="+radioName+"]")[0];
$(radioFirst).prop("checked",true)
} else {
$(this).val('');
}
});
}
</script> </script>
<title>교육문의</title> <title>교육문의</title>

View File

@ -168,25 +168,20 @@
}); });
} }
//초기화
function fncReset(thisObj) { function fncReset(thisObj){
var targetObj = $(thisObj).closest('.list_top').find('select,input'); var targetObj = $(thisObj).closest('.list_top').find('select,input');
$.each(targetObj, function() { $.each(targetObj, function(){
if ($(this).prop('tagName') == 'SELECT') { if ($(this).prop("tagName") == 'SELECT') {
if ($(this).attr('name').indexOf('Month') != -1) { // 초기화 시 무조건 select option 첫번째 지정
$(this).val(new Date().getMonth() + 1); $(this).find("option:first-child").prop("selected",true);
} else if ($(this).attr('name').indexOf('Year') != -1) { } else if ($(this).attr('type') == 'radio') {
$(this).val(new Date().getFullYear()); var radioName = $(this).attr("name");
} else { var radioFirst = $("[name="+radioName+"]")[0];
$(this).prop("selectedIndex", 0); $(radioFirst).prop("checked",true)
}
} else {
if ($(this).attr('type') == 'checkbox') {
$(this).prop('checked', false);
} else { } else {
$(this).val(''); $(this).val('');
} }
}
}); });
} }

View File

@ -170,24 +170,19 @@
} }
//초기화 //초기화
function fncReset(thisObj) { function fncReset(thisObj){
var targetObj = $(thisObj).closest('.list_top').find('select,input'); var targetObj = $(thisObj).closest('.list_top').find('select,input');
$.each(targetObj, function() { $.each(targetObj, function(){
if ($(this).prop('tagName') == 'SELECT') { if ($(this).prop("tagName") == 'SELECT') {
if ($(this).attr('name').indexOf('Month') != -1) { // 초기화 시 무조건 select option 첫번째 지정
$(this).val(new Date().getMonth() + 1); $(this).find("option:first-child").prop("selected",true);
} else if ($(this).attr('name').indexOf('Year') != -1) { } else if ($(this).attr('type') == 'radio') {
$(this).val(new Date().getFullYear()); var radioName = $(this).attr("name");
} else { var radioFirst = $("[name="+radioName+"]")[0];
$(this).prop("selectedIndex", 0); $(radioFirst).prop("checked",true)
}
} else {
if ($(this).attr('type') == 'checkbox') {
$(this).prop('checked', false);
} else { } else {
$(this).val(''); $(this).val('');
} }
}
}); });
} }

View File

@ -217,7 +217,7 @@
} }
//초기화 //초기화
function fncReset(thisObj) { /*function fncReset(thisObj) {
var targetObj = $(thisObj).closest('.list_top').find('select,input'); var targetObj = $(thisObj).closest('.list_top').find('select,input');
$.each(targetObj, function() { $.each(targetObj, function() {
if ($(this).prop('tagName') == 'SELECT') { if ($(this).prop('tagName') == 'SELECT') {
@ -236,6 +236,21 @@
} }
} }
}); });
}*/
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') {
var radioName = $(this).attr("name");
var radioFirst = $("[name="+radioName+"]")[0];
$(radioFirst).prop("checked",true)
} else {
$(this).val('');
}
});
} }
function showMemo(obj){ function showMemo(obj){