## FOREACH 문
.each()함수는 jQuery 객체의 수만큼 for 문 같이 반복을 해주는 함수입니다.
$('input', $('#TABLE명')).each(function () { // TABLE명이라는 id를 가진 table 안에 모든 input만큼 each를 실행
$(this).attr("disabled", "disabled"); //모든 input 속성을 disabled 시킨다.
if ( ($(this).attr("id") == "AAA")||($(this).attr("id") == "BBB") ) {
$(this).removeAttr("disabled");
}
});
.each()함수는 jQuery 객체의 수만큼 for 문 같이 반복을 해주는 함수입니다.
$('input', $('#TABLE명')).each(function () { // TABLE명이라는 id를 가진 table 안에 모든 input만큼 each를 실행
$(this).attr("disabled", "disabled"); //모든 input 속성을 disabled 시킨다.
if ( ($(this).attr("id") == "AAA")||($(this).attr("id") == "BBB") ) {
$(this).removeAttr("disabled");
}
});
'개발노트 > jQuery' 카테고리의 다른 글
Xml 노드 replace , xml node replace (0) | 2018.07.19 |
---|---|
주민번호 뒷자리 자동 0으로 채우기 (0) | 2018.07.07 |
isNaN 란?? (0) | 2017.12.06 |