Document.images is a read-only instance property that returns a live HTMLCollection of every <img> in the document. Learn MDN’s banner search loop, index vs item() access, live updates, and five examples with try-it labs.
01
Kind
Read-only
02
Returns
HTMLCollection
03
Items
HTMLImageElement
04
Live
Updates
05
Access
[0] / item()
06
Status
Baseline widely
Fundamentals
Introduction
Need every image on a page without writing a selector? document.images gives you a ready-made collection of all <img> elements.
MDN: the read-only property returns a collection of the images in the current HTML document. Each entry is an HTMLImageElement representing a single image element.
Document.images is marked Baseline Widely available on MDN (since June 2018). Logos use the shared browser-image-sprite.png sprite from this project.
✓ Baseline · Widely available
Document.images
Read-only live HTMLCollection of every img element in the document.
UniversalWidely available
Google ChromeFull support · Desktop & Mobile
Full support
Mozilla FirefoxFull support · Desktop & Mobile
Full support
Apple SafariFull support · macOS & iOS
Full support
Microsoft EdgeFull support · Chromium
Full support
OperaFull support · Modern versions
Full support
Internet ExplorerSupported in legacy IE
Full support
Document.imagesExcellent
Bottom line: Use document.images for quick access to all img elements. Prefer querySelectorAll when you need filtered or scoped queries.
Wrap Up
Conclusion
Document.images is a simple, live shortcut to every <img> on the page. Use it to count, loop, and inspect HTMLImageElement properties — or reach for querySelectorAll when you need more specific queries.
Expect CSS background images to appear in the collection
Cache length across long loops if DOM may change mid-loop
Confuse live HTMLCollection with static NodeList behavior
Skip alt on informative images you add dynamically
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about document.images
All img elements in one live collection.
5
Core concepts
📄01
Returns
HTMLCollection
API
🖼02
Items
HTMLImageElement
<img>
🔄03
Live
Auto-updates
MDN
🔢04
Access
[0] / item()
Equivalent
🔍05
Loop
for...of
MDN
❓ Frequently Asked Questions
A read-only HTMLCollection of every <img> element in the document. Each item is an HTMLImageElement (MDN).
No. MDN marks Document.images as Baseline Widely available (since June 2018). It is a standard Document collection property.
Yes. MDN describes it as a live list — when images are added or removed, document.images updates automatically.
Use document.images[0] or document.images.item(0). MDN notes both are equivalent.
document.images is a live HTMLCollection of img elements only. querySelectorAll returns a static NodeList and accepts any CSS selector.
No. Only <img> elements in the HTML document — not background-image styles or SVG images unless they use an <img> tag.
Did you know?
document.images is one of several legacy-named Document collections (along with forms, links, and anchors) that predate modern querySelector APIs—but remain widely supported and convenient for all-images access.