"JQuery .get()"의 두 판 사이의 차이

(새 문서: ==개요== ;jQuery .get() *jQuery 객체에 맞는 DOM 요소 인출 ==참고 자료== *https://api.jquery.com/get/ 분류: jQuery)
 
잔글 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
 
(사용자 2명의 중간 판 6개는 보이지 않습니다)
1번째 줄: 1번째 줄:
{{소문자}}
{{다른뜻|jQuery $.get()}}
==개요==
==개요==
;jQuery .get()
;jQuery .get()
*jQuery 객체에 맞는 DOM 요소 인출
*jQuery 객체에 맞는 [[DOM요소]] 인출


==참고 자료==
==예시==
*예제: http://zetawiki.com/ex/jquery/get.html
<syntaxhighlight lang='html5'>
<script src="//code.jquery.com/jquery.min.js"></script>
<script>
$(function() {
$('#button1').click(function() {
console.log( $(this).get(0) ); // <button id="button1">버튼1</button>
console.log( $(this).get(0).nodeName ); // BUTTON
});
$('#button2').click(function() {
console.log( $('#mylist>li').get(-2) ); // <li>항목2</li>
});
});
</script>
 
<ul id='mylist'>
  <li>항목1</li>
  <li>항목2</li>
  <li>항목3</li>
</ul>
 
<button id='button1'>버튼1</button>
<button id='button2'>버튼2</button>
</syntaxhighlight>
==같이 보기==
*[[jQuery .eq()]]
 
==참고==
*https://api.jquery.com/get/
*https://api.jquery.com/get/


[[분류: jQuery]]
[[분류: jQuery]]

2020년 11월 2일 (월) 02:53 기준 최신판

  다른 뜻에 대해서는 jQuery $.get() 문서를 참조하십시오.

1 개요[ | ]

jQuery .get()

2 예시[ | ]

<script src="//code.jquery.com/jquery.min.js"></script>
<script>
$(function() {
	$('#button1').click(function() {
		console.log( $(this).get(0) ); // <button id="button1">버튼1</button> 
		console.log( $(this).get(0).nodeName ); // BUTTON
	});
	$('#button2').click(function() {
		console.log( $('#mylist>li').get(-2) ); // <li>항목2</li>
	});
});
</script>
 
  
<ul id='mylist'>
  <li>항목1</li>
  <li>항목2</li>
  <li>항목3</li>
</ul>

<button id='button1'>버튼1</button>
<button id='button2'>버튼2</button>

3 같이 보기[ | ]

4 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}