Home » Jquery » javascript – How to get all children of a object in jquery?

javascript – How to get all children of a object in jquery?

Posted by: admin February 22, 2020 Leave a comment

Questions:

I am trying to get all children of a object but it shows me prevobject in console.

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

Here is my code

var j = $(".all .product-categories .products-and-banner .section:first-child .products .product-wrapper").children();
			console.log(j);

I have also tried ready function of jquery, but still says prevobject.

How to access the object and the all children of the object?

Here is a working example without children.

var j = $(".all .product-categories .products-and-banner .section:first-child .products .product-wrapper")[0];
			console.log(j); //working example without children
How to&Answer: