본문 바로가기
개발/jquery

2010-12-28

by rudnine 2010. 12. 29.
반응형
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>eventDiary</title>
</head>
 
<body>

<form>
<input type="checkbox" name="" />
<input type="radio" name="" />
<input type="text" name="" />
<input type="button" name="" />
</form>

<form>
<input type="checkbox" name="" />
<input type="radio" name="" />
<input type="text" name="" />
<input type="button" name="" />
</form>

<input type="checkbox" name="" />
<input type="radio" name="" />
<input type="text" name="" />
<input type="button" name="" />

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

<script type="text/javascript">

// form 안의 input 요소를 모두 찾는다. 8개 출력
alert('selected ' + jQuery('input',$('form')).length + ' inputs' );

// 첫번째 form 안의 input 요소를 모두 찾는다. 4개 출력
alert('selected ' + jQuery('input', document.forms[0]).length + ' inputs' );

// body 안의 모든 input 요소를 찾는다. 12개 출력
alert('selected ' + jQuery('input', 'body').length + ' inputs' );

</script>
</body>
</html>

 
반응형

'개발 > jquery' 카테고리의 다른 글

2011-1-1  (0) 2011.01.01
jQuery 관련링크모음  (0) 2010.12.30
2010-12-26  (0) 2010.12.26
2010-12-25  (0) 2010.12.25
jQuery Attribute Selectors  (0) 2010.12.22

댓글