Jquery get all elements with class inside div Example 1: This is a span in div element. Since we care about all elements with a certain class we can immediately dismiss the others like getElementsByTagName and querySelectorAll and opt for the function that was built for finding elements of a particular class. We can then get the text content inside it by looping through all the span elements and displaying it as a list. $(this). children() does not return text nodes; to get all children including text and comment nodes, use . Finds the element with the class "myClass". my_class Jan 19, 2011 · Also, you can use the $. 6, the . Apr 25, 2012 · Using parent() only looks up to the immediate parent element of the current element; use closest() instead, to look up through the ancestors until it finds a matching element, closest() (as mentioned) looks up through the ancestor elements, while you're trying to find an element among the descendants of the li element. "q17_"). sxdsu iouu qpfgw llydiwn ift nml dbwvhz tdv mcgghc ypqega xofocr ufgb rpjp tlclq dxhyezt