JavaScript Element ariaValueMax Property

Beginner
⏱️ 11 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Baseline
Instance property

What You’ll Learn

Element.ariaValueMax is an instance property that reflects the aria-valuemax attribute. Learn how it declares the maximum allowed value for a range widget, how it pairs with aria-valuemin and aria-valuenow, and how to get or set it from JavaScript—with five examples and try-it labs.

01

Kind

Instance property

02

Type

String (number)

03

Meaning

Maximum allowed

04

Reflects

aria-valuemax

05

Status

Baseline widely

06

Used on

Slider · range

Introduction

Range widgets—volume sliders, progress bars, day-of-week pickers—have a lowest and highest allowed value. Assistive technologies need the maximum so they can announce the scale (for example “1 to 7”).

aria-valuemax declares that ceiling. The DOM property ariaValueMax lets you read and update it from JavaScript.

JavaScript
const el = document.getElementById("slider");
console.log(el.ariaValueMax); // "7"
el.ariaValueMax = "6";
💡
Beginner tip

Prefer <input type="range"> when a native control fits. Use ariaValueMax for custom role="slider", progressbar, spinbutton, or scrollbar widgets.

Understanding the Property

MDN: the ariaValueMax property of the Element interface reflects the value of the aria-valuemax attribute, which defines the maximum allowed value for a range widget.

  • Reflected attribute — mirrors aria-valuemax.
  • Get / set — readable and writable string number.
  • Range ceiling — the highest allowed value.
  • Baseline — widely available since October 2023 (MDN).

📝 Syntax

JavaScript
ariaValueMax

Value

A string which contains a number (the maximum allowed value).

ItemDetail
Typestring containing a number (e.g. "7")
Reflectsaria-valuemax
Applies toslider, progressbar, spinbutton, scrollbar, and similar ranges
Pair witharia-valuemin, aria-valuenow, optional aria-valuetext
⚠️
Keep the range consistent

Ensure aria-valueminaria-valuenowaria-valuemax. If you shrink the max, clamp the current value so it does not sit above the new ceiling.

📋 MDN Slider Example Shape

MDN starts with a slider marked aria-valuemax="7", then updates ariaValueMax to "6":

JavaScript
<div
  id="slider"
  role="slider"
  aria-valuenow="1"
  aria-valuemin="1"
  aria-valuemax="7"
  aria-valuetext="Sunday"></div>
JavaScript
let el = document.getElementById("slider");
console.log(el.ariaValueMax); // "7"
el.ariaValueMax = "6";
console.log(el.ariaValueMax); // "6"

This pattern often models days of the week (1–7) with aria-valuetext providing a spoken label like “Sunday.”

⚡ Quick Reference

GoalCode / note
Readel.ariaValueMax
Writeel.ariaValueMax = "6"
HTML attributearia-valuemax="7"
Native cousinmax on <input type="range">
MDN statusBaseline Widely available

🔍 At a Glance

Four facts about Element.ariaValueMax.

Kind
get / set

Instance

Type
string

Number text

Reflects
aria-valuemax

Attribute

Baseline
widely

Oct 2023+

Examples Gallery

Examples follow MDN Element: ariaValueMax. Labs use a role="slider" so you can safely read and write the property.

📚 Getting Started

Read the reflected value and follow MDN’s max update.

Example 1 — Read ariaValueMax

Log the maximum from a custom slider.

JavaScript
const el = document.getElementById("slider");
console.log(el.ariaValueMax);

// HTML includes: aria-valuemax="7"
Try It Yourself

How It Works

The property returns the attribute string. If the attribute is missing, many browsers return null.

Example 2 — MDN Update to "6"

MDN: change the maximum from 7 to 6.

JavaScript
let el = document.getElementById("slider");
console.log(el.ariaValueMax); // "7"
el.ariaValueMax = "6";
console.log(el.ariaValueMax); // "6"
Try It Yourself

How It Works

Assigning the property updates the reflected aria-valuemax attribute. Also update visuals and clamp aria-valuenow if needed.

📈 Clamp Current, Attribute Sync & Snapshot

Practice keeping now within min–max and verify reflection.

Example 3 — Clamp aria-valuenow After Max Change

If the current value sits above the new max, pull it down.

JavaScript
const el = document.createElement("div");
el.setAttribute("role", "slider");
el.setAttribute("aria-valuemin", "0");
el.setAttribute("aria-valuenow", "10");
el.setAttribute("aria-valuemax", "10");
document.body.appendChild(el);

el.ariaValueMax = "5";
const now = Number(el.getAttribute("aria-valuenow"));
const max = Number(el.ariaValueMax);
if (now > max) {
  el.setAttribute("aria-valuenow", String(max));
}
console.log({
  ariaValueMax: el.ariaValueMax,
  ariaValueNow: el.getAttribute("aria-valuenow")
});
Try It Yourself

How It Works

Shrinking the max without clamping aria-valuenow can leave an invalid range. Keep min ≤ now ≤ max at all times.

Example 4 — Property vs getAttribute

Confirm the attribute stays in sync after a write.

JavaScript
const el = document.createElement("div");
el.setAttribute("role", "slider");
el.setAttribute("aria-valuemax", "7");
document.body.appendChild(el);

el.ariaValueMax = "6";
console.log({
  fromProperty: el.ariaValueMax,
  fromAttribute: el.getAttribute("aria-valuemax"),
  same: el.ariaValueMax === el.getAttribute("aria-valuemax")
});
Try It Yourself

How It Works

Prefer ariaValueMax in script; keep the attribute for HTML markup.

Example 5 — Support Snapshot

Feature-detect and remember the min / now / max trio.

JavaScript
console.log({
  supported: "ariaValueMax" in Element.prototype,
  pairWith: ["aria-valuemin", "aria-valuenow", "aria-valuetext"],
  tip: "Prefer input type=range when a native control fits",
  status: "Baseline Widely available (MDN)"
});
Try It Yourself

How It Works

Do not let the ARIA max disagree with the visual track length—mismatched ranges confuse AT users.

🚀 Common Use Cases

  • Custom volume, brightness, or seek sliders.
  • Progress bars with a known maximum (for example 100%).
  • Spinbuttons and day/week pickers with a fixed upper bound.
  • Dynamically shrinking a range (for example fewer days available).
  • Keeping script and markup aligned without manual setAttribute.

🔧 How It Works

1

Define the range

Min and max set the allowed scale.

Bounds
2

ariaValueMax sets the ceiling

Highest value the widget may reach.

Max
3

Keep now inside the range

Clamp aria-valuenow when max changes.

Now
4

Assistive tech understands the scale

Users hear min, now, and max together.

📝 Notes

  • Not Deprecated, Experimental, or Non-standard on MDN (Baseline Widely available).
  • Value is a string containing a number.
  • Prefer native <input type="range"> when it fits.
  • Related: ariaSort, ariaValueMin, EventTarget, JavaScript hub.

Browser Support

Element.ariaValueMax is Baseline Widely available (MDN: across browsers since October 2023). Logos use the shared browser-image-sprite.png sprite from this project.

Baseline Widely available

Element.ariaValueMax

String number — reflects aria-valuemax (maximum for a range widget).

Baseline Widely available
Google Chrome Supported (ARIA reflection)
Yes
Microsoft Edge Supported (ARIA reflection)
Yes
Mozilla Firefox Supported (ARIA reflection)
Yes
Apple Safari Supported (ARIA reflection)
Yes
Opera Follow Chromium support
Yes
Internet Explorer No ariaValueMax IDL — use setAttribute
No
ariaValueMax Baseline

Bottom line: Use ariaValueMax to get/set aria-valuemax. Keep min ≤ now ≤ max. Prefer native range inputs when possible. Pair with aria-valuemin, aria-valuenow, and optional aria-valuetext.

Conclusion

ariaValueMax reflects aria-valuemax so range widgets can declare their maximum. Use string numbers, keep now within the bounds, and prefer native range inputs when they are enough.

Continue with ariaValueMin, ariaSort, or the JavaScript hub.

💡 Best Practices

✅ Do

  • Use string numbers for the maximum
  • Keep min ≤ now ≤ max
  • Clamp now when you shrink the max
  • Prefer native type="range" when possible
  • Add aria-valuetext for readable labels

❌ Don’t

  • Leave now above the new maximum
  • Treat the value as a Number type in ARIA APIs
  • Set max below min
  • Rebuild native range inputs with ARIA without need
  • Forget to update visuals when max changes

Key Takeaways

Knowledge Unlocked

Five things to remember about ariaValueMax

Reflected aria-valuemax string for the maximum of a range widget.

5
Core concepts
📝 02

String number

maximum value

Type
🔍 03

Slider · range

custom widgets

Use
04

Baseline

widely available

Status
🎯 05

min · now · max

keep in sync

Tip

❓ Frequently Asked Questions

It reflects the aria-valuemax attribute as a string containing a number that defines the maximum allowed value for a range widget (for example a slider, progressbar, spinbutton, or scrollbar).
No. MDN marks Element.ariaValueMax as Baseline Widely available (since October 2023). It is not Deprecated, Experimental, or Non-standard.
A string that contains a number (for example "7" or "6"), not a JavaScript Number type.
Use aria-valuemax with aria-valuemin (minimum), aria-valuenow (current), and optionally aria-valuetext (human-readable label).
Yes when possible. An HTML <input type="range"> already exposes min, max, and value without custom ARIA. Use ariaValueMax for custom range widgets.
Yes. Reading and writing ariaValueMax updates the reflected aria-valuemax attribute.
Did you know?

MDN’s day-of-week slider uses aria-valuemax="7" with aria-valuetext="Sunday"—the number is the machine value; the text is what users hear.

Next: Element ariaValueMin

Learn the reflected aria-valuemin property for range widget minimums.

ariaValueMin →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful