0

I am trying to grab the image source of the club logo on this page using jQuery https://www.ea.com/en-gb/games/fifa/fifa-21/pro-clubs/ps5-xbsxs/overview?clubId=4481&platform=ps5 (the page does not have jQuery by default so I used the Chrome jQuery injector plugin to attempt this).

enter image description here

In the console I am trying to grab the source of the image using the following jQuery command - jQuery('img#img').attr('src'); but it returns undefined

enter image description here

-- Expected result --

https://fifa21.content.easports.com/fifa/fltOnlineAssets/05772199-716f-417d-9fe0-988fa9899c4d/2021/fifaweb/crests/256x256/l99060110.png

-- Actual result --

undefined

Chrome jQuery injector plugin - https://chrome.google.com/webstore/detail/jquery-injector/ekkjohcjbjcjjifokpingdbdlfekjcgi?hl=en

Zabs
  • 13,852
  • 45
  • 173
  • 297
  • 1
    That means it doesn't exist in the DOM as of when you go looking for it. The **only** time `attr` returns `undefined` is when the jQuery set you call it on is empty. Presumably the image is added later. – T.J. Crowder Aug 31 '21 at 08:09
  • I am running the command in the Chrome console after the page has loaded – Zabs Aug 31 '21 at 08:10
  • 1
    Then the image isn't in the DOM of the document the console is attached to, not with that `id`. (Or it's not an `img` element, since you've used `img#img`.) What you've shown is an `img` with seemingly the `id` `"img"`, but if it were there and in the document the console is attached to, it would be found. Perhaps it's in an `iframe`? – T.J. Crowder Aug 31 '21 at 08:11

0 Answers0