Skip to content
Advertisement

How to parse multiple div with same class name in a div in cheerio?

I have “n” number of classes with className: “classparent” In which I have “n” number of classes with className: “class1” which consists of “n” number of div’s with className: “class2”

How can I parse each and every of these div.class2 and get their style property in cheerio ???

Currently I am doing this :

JavaScript

It returns me only one div.class2 from every .class1.

I want results like this:

JavaScript

And this is how my objects would look like:

JavaScript

Advertisement

Answer

You can use the toArray function:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement