Front/JS & jQuery

[jQuery] .is()

오선지♬ 2025. 7. 8. 20:29
728x90
반응형

✅ .is() 문법

$(selector).is(selectorOrFunction)

 

  • selectorOrFunction: CSS 선택자, DOM 요소, jQuery 객체, 또는 함수
  • 반환값: true 또는 false

 

📌 .is() 예

$('.box').each(function() {
    if ($(this).is('.box')) {
        console.log('이 요소는 box 클래스입니다.');
    }
});

 

 

  • .is('.box'): 자신이 .box 클래스인지 확인

 

728x90
반응형

'Front > JS & jQuery' 카테고리의 다른 글

[js] location.origin  (0) 2025.07.10
[js] navigator.clipboard.writeText()  (0) 2025.07.09
[jQuery] .has()  (0) 2025.07.07
[js] hide() / remove()  (0) 2025.07.05
[js] 중복 클릭 방지 처리 - 플래그 변수 사용  (0) 2025.07.02