I want to extract information out of an HTML document with Cheerio. I cannot alter the content of the HTML file as it has an external origin.
The element I want to extract has a class name with a dot in it:
<span class='prop-data.size'> the content </span>
If I use the class name in Cheerio as a selector, I do not get back the element.
$('.prop-data.size').text() <-- gives null
Is it possible to select an element by a class name with a dot in it in Cheerio?
Can I escape the dot or so?
Yes, escape the
.:An attribute selector is also possible:
'[class~="prop-data.size"]'.