jquery - TypeError: undefined is not a function - .parent() -


I am learning jquery and navigating the tree and playing around with me.

  $ ('Quick-info') $ list ('. Quick-info') [0] grabs the first element in that list  
< P> When I try to find the origin of the first element in that list

  $ ('Quick-info') [0]. Parent ()  

I get an error:

  Type error: there is no undefined function  

What do I do Am I wrong?

If you call the jQuery parent () method on the first element If you set back, you will need to wrap it again in the jQuery selector:

  $ ($ ('Quick-info') [0]). mother-father ();  

... or you can use to get the mailing element first:

  $ ('. Quick-info'). first (). ();  

... Or, as Cheery, you can use instead of [0] :

  Get $ ('quick info') (0) .parent ();  

Otherwise, you are trying to call the jQuery parent () method on the HTML node (on which the function is not originally present).


Comments