쫑가 과정

선택자를 이용한 선택 본문

JavaScript/jQuery

선택자를 이용한 선택

쫑가 2021. 9. 3. 16:58

모든 Selector 적용보기.

 

Try jQuery Selector

My name is Donald Duck I live in Duckburg I have many friends:

www.w3schools.com

Selector

 

Selectors | jQuery API Documentation

Select all elements that are in the progress of an animation at the time the selector is run. Selects elements that have the specified attribute with a value either equal to a given string or starting with that string followed by a hyphen (-). Selects elem

api.jquery.com

CSS 선택자를 이용한 선택

See the Pen by jongha (@gajong) on CodePen.

 

 

tagName - $("tagName")
id - $("#id")
className - $(".class")
attribute - $("선택자[attName='값']")

//속성변경
.attr("attName", "변경 값")

jQuery Selector

변수 선택한 요소의 저장

요소를 선택하여 변수에 저장한 후, 해당 변수를 사용.

$(function() {
	varitems = $("li"); // <li>요소를 모두 선택해 변수 items에 저장.
})

선택한 요소의 필터링

선택한 요소 중에서 더욱 세분화된 선택을 하기 위해 사용.

 

Filtering | jQuery API Documentation

Reduce the set of matched elements to the one at the specified index. Reduce the set of matched elements to the even ones in the set, numbered from zero. Reduce the set of matched elements to those that match the selector or pass the function’s test. Red

api.jquery.com

예제)

See the Pen by jongha (@gajong) on CodePen.

 

 

form 요소의 선택.

력 양식에 관련된 특정 요소를 손쉽게 선택

 

Form | jQuery API Documentation

Selects all button elements and elements of type button. Selects all elements of type checkbox. Matches all elements that are checked or selected. Selects all elements that are disabled. Selects all elements that are enabled. Selects all elements of type f

api.jquery.com

예제)

See the Pen by jongha (@gajong) on CodePen.

 

 

 

'JavaScript > jQuery' 카테고리의 다른 글

jQuery 연습, 테스트  (0) 2021.09.10
jQuery. 요소의 추가 / 1. 기존 요소의 내부에 추가  (0) 2021.09.08
선택된 요소 접근  (0) 2021.09.06
jQuery?  (0) 2021.09.03
Comments