MDN self-hosted library · e01.org

Element: ariaPressed property

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

html
<div id="saveChanges" tabindex="0" role="button" aria-pressed="false">Save</div>
js
let el = document.getElementById("saveChanges");
console.log(el.ariaPressed); // "false"
el.ariaPressed = "true";
console.log(el.ariaPressed); // "true"