DOM Interfaces
HTMLImageElement
Represents an image and exposes resource selection, intrinsic dimensions, loading and decoding controls. A complete flag does not guarantee a successful load; check the relevant load/error state and intrinsic dimensions where appropriate. Example result: Blue dot.
Formal Syntax & Structure
html syntaxhtml
const element = document.getElementById('demo'); // HTMLImageElementReturn Value
HTMLImageElement
An existing HTML DOM object associated with the img element in this example; this interface is a type, not a function return contract.
Working Example
Example Snippethtml
<img id="demo" alt="Blue dot" width="24" height="24"><p> Result: <output id="result"></output></p><script> const e = document.getElementById('demo'); const result = value => { document.getElementById("result").textContent = String(value); }; result(e.alt);</script>