toujours

jquery 사용시 find is not a function 오류 (배열[N].find) 본문

카테고리 없음

jquery 사용시 find is not a function 오류 (배열[N].find)

toujours_ 2023. 1. 17. 00:04

<div id='a'></div>

<div id='b'></div>

$('div') 의 결과가 2개이상일때,

$('div')는 jquery객체이자 [DOM, DOM]을 반환한다.

 

이때 DOM.find는 먹히지 않음. jquery객체만 find 가능.

 

이럴땐  vanilla js로 querySelector쓰던가

$(this)로 clone()해서 쓰던지 하자.

 

아래 링크 참고

https://stackoverflow.com/questions/24300762/jquery-throws-an-error-that-element-find-is-not-a-function 

 

jQuery throws an error that element.find() is not a function

I have written a small JS to iterate through a set of matched elements and perform some task on each of them. Here is the code: var eachProduct = $(".item"); eachProduct.each(function(index, ele...

stackoverflow.com

 

반응형
Comments