// Get the SVG image element
const imageElement = document.querySelector("image");
// Access the href property
const href = imageElement.href.baseVal;
console.log(href); // Output: The href valueSVGImageElement: href property / notebook
SVGImageElement: href property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.