Home > front end >  How can I select a specific image's url on a webpage using jquery?
How can I select a specific image's url on a webpage using jquery?

Time:08-02

So I want to scrape this webpage:

And I tried codes like this:

$(".article-cover-img").attr("src")

And everything similar to that, but I can't get the src value of the image. How can I do that?

CodePudding user response:

Try this :

$(".article-cover-img > img").attr("src");

because you are selecting div instead of img element.

i hope it was useful.

  • Related