Form관련 jQuery 선택기 명령어 - :input (모든 폼 요소 읽어오기)
.NET프로그래밍/jQuery 1.3.2 2009. 11. 9. 11:10 |[Input.htm]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>모든 폼 요소 읽어오기</title>
<script src="../js/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
var result = "";
// 폼 요소가 있는 만큼 반복하자.
//alert($(':input').size());
$(':input').each(function(index) {
result += "태그명 : " + $(this).get(0).tagName // this.tagName
+ ", type 속성명 : " + $(this).attr('type') + '\n';
});
alert(result);
});
</script>
</head>
<body>
<input type="button" value="Input Button"/><br />
<input type="text"/><br />
<input type="password"/><br />
<input type="checkbox"/><br />
<input type="file"/><br />
<input type="hidden"/><br />
<input type="image"/><br />
<input type="radio"/><br />
<input type="reset"/><br />
<input type="submit"/><br />
<select><option>드롭다운리스트</option></select><br />
<textarea>멀티라인텍스트박스</textarea><br />
<button>버튼</button><br />
</body>
</html>
-------------------------------------------------------------------------------------
[실행결과]
'.NET프로그래밍 > jQuery 1.3.2' 카테고리의 다른 글
Form관련 jQuery 선택기 명령어 - 암호확인(PasswordConfirm) 기능 구현하기 (0) | 2009.11.09 |
---|---|
Form관련 jQuery 선택기 명령어 - :text (텍스트박스의 값 복사) (0) | 2009.11.09 |
jQuery인덱서(Indexer)를 사용하여 HTML 요소 가져오기 (0) | 2009.11.09 |
jQuery Core 명령어 - Each()메서드로 반복 탐색 (요소만큼 반복해서 속성 설정 및 가져오기) (0) | 2009.11.09 |
콜백(CallBack) : 매개변수로 함수를 전달 (0) | 2009.11.09 |