DEV/자바스크립트
특정 테이블의 td 값 및 input 값 초기화 하기
거대한 개발자
2017. 8. 30. 09:02
반응형
특정 테이블의 input 값이나 <td></td> 안에 있는 텍스트 값을 초기화 하는 함수를 만들었습니다.
/**
* 입력 항목 및 td 값 초기화
* @param argObj 테이블 or form Object
*/
fncInputReset : function(argObj){
// select 초기화
$('#'+argObj).find('select').each(function(){
this.value = '';
tmJs.fncComboSelectAndTextChange(this.id, this.value); // 콤보박스 값 셋팅
});
// input 초기화
$('#'+argObj).find('input').each(function(){
this.value = '';
});
// textarea 초기화
$('#'+argObj).find('textarea').each(function(){
this.value = '';
});
// TD 값 초기화
$('#'+argObj).find('td').each(function(){
// TD에 id 값이 있는 단순 조회 항목 초기화
if(this.id !== null && this.id !== ''){
$(this).html(' ');
}
});
}