DOM Properties
Document.images
Returns a live collection of img elements; CSS background images are excluded. Mutating the document can change its length. This is an HTMLCollection, not an array or a list of decoded resources. It includes img nodes whether or not their image data loaded. If removing members while iterating, first make a snapshot with Array.from(document.images). Example result: 2.
Formal Syntax & Structure
html syntaxhtml
document.imagesReturn Value
HTMLCollection
Live HTMLCollection of img elements in the document.
Working Example
Example Snippethtml
<img alt="One"><img alt="Two"><p> Result: <output id="result"></output></p><script> const result = document.getElementById("result"); (async () => { result.textContent = document.images.length; })().catch(error => { result.textContent = "Error: " + error.name; });</script>