I'm using cheerio in node.js to get elements of a site. With this one, I'll make stars and other things.
I would like to take only the text in the following code:
<div id="graphDD3" class="pie-chart small" style="padding: 0px; position: relative;">
42.2%
<canvas class="flot-base" style="direction: ltr; position: absolute; left: 0px; top: 0px; width: 100px; height: 100px;" width="100" height="100"></canvas>
<canvas class="flot-overlay" style="direction: ltr; position: absolute; left: 0px; top: 0px; width: 100px; height: 100px;" width="100" height="100"></canvas>
</div>
I tried the following code
let rate = $('#graphDD3').text().trim();
console.log(rate);
But my console says 0
instead of 42.2%
Someone can help me ? Or do you know a another solutions to resolve this one ?
Thank you to those who will take the time to help me.