1. 폼요소 정보 가져오기
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html;" charset="utf-8" >
<title> 요소만큼 반복해서 속성 설정 및 가져오기 </title>
<script src="http://code.jquery.com/jquery-1.7.2.js"></script>
<style type="text/css">
.red{color:red;}
</style>
<script>
$(document).ready(function (){
//alert($(':input').size());
var result = "";
$(':input').each(function(index){
result += "태그명 : " + 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>
'강좌 > jQuery' 카테고리의 다른 글
jQuery Attributes(jQuery로 요소의 속성 변경하기) - 1 (0) | 2013.04.22 |
---|---|
제이쿼리(jQuery) - jQuery 선택기 설명 2 (패스워드 일치) (0) | 2013.04.22 |
제이쿼리(jQuery) - each() 메서드 (0) | 2013.04.22 |
제이쿼리(jQuery) - css() 메서드와 콜백함수(CallBack) (0) | 2013.04.22 |
제이쿼리(jQuery) - toggle(), toggleClass(), hover(), one() 메서드. (0) | 2013.04.22 |