Cheerio how to get the tag name of one element

1.7k Views Asked by At

I am using Cheerio to scrape one web site, i need to know the tag name of the element , but according to Cheerio API there is not any property that retrieve that. My snippet of code :

const links = $("body").find("path...");
link.each((i,elem)=>{
   elem.name;
});

i am using typescript in NodeJs,Typescript throws an error saying that this property does not even exist.

Thanks in advance. Best regards.

1

There are 1 best solutions below

0
tt0686 On

I found the answer $(element).get(0).tagName

Thanks