The result of the jquery selector is prevObject: e.fn.e.init [3] how to get an element from this

I have a selector $('.element')returns prevObject: e.fn.e.init[3]. I looked at the results, and the first object is what I need. 2 questions. What is prevObject? Just as I can choose the first object from the result. Thanks for any help.

+5
source share
1 answer

To access the first item, simply use [0]or.get(0)

prevObjectis the result of a previous jQuery function call if the calls were connected together. This is what allows the call to .end()return the jQuery chain back to its previous state.

+10
source

All Articles