Home >Web Front-end >JS Tutorial >Example of usage of find() method in jQuery_jquery
The example in this article describes the usage of find() method in jQuery. Share it with everyone for your reference. The specific analysis is as follows:
This method gets the child elements of all elements in the matching element collection and deletes them by selector, jQuery object or element.
The find() method is a good way to get descendant elements of the matching element.
Note: children() only gets first-level child elements, while find() will find all child elements.
Grammar structure 1:
Parameter list:
Example code:
I am grandson p
I am my sonp
I am a brotherp
The above code can set the font color of all p elements under the father element to red.
Grammar structure 2:
Can find the specified element under the matching element.
Parameter list:
예제 코드:
나는 내 아들입니다
저는 형제입니다p
위 코드는 father 요소 아래 id 속성 값이 myp인 요소의 테두리를 1픽셀 빨간색으로 설정할 수 있습니다.
이 기사가 모든 사람의 jQuery 프로그래밍에 도움이 되기를 바랍니다.