I have a selector $('.element') is returning prevObject: e.fn.e.init[3]. I looked into the results and the first object there is what I need. 2 questions here. What is prevObject? Also how can I select from the result the first object. Thanks for any help.
I have a selector $(‘.element’) is returning prevObject: e.fn.e.init[3] . I looked into the
Share
To access the first element, simply use
[0]or.get(0)prevObjectis the result of the previous jQuery function call if the calls were chained together. It’s what allows the.end()call to pop the jQuery chain back to a prior state.