Input Range max Attribute

Definition and Usage

max Set or return the value of the max attribute of the slider control.

The HTML max attribute specifies the maximum value of the slider control.

Tip:The max attribute is usually used with min attribute Use together to create a valid value range.

Tip:To set or return the value of the min attribute, use min attribute.

See also:

HTML Reference Manual:HTML <input> max Attribute

Instance

Example 1

Get the maximum allowed value of the slider control:

var x = document.getElementById("myRange").max;

Try it yourself

Example 2

Change the maximum value:

document.getElementById("myRange").max = "90";

Try it yourself

Syntax

Return the max attribute:

rangeObject.max

Set the max attribute:

rangeObject.max = number

Attribute Value

Value Description
number Specifies the maximum value allowed for the slider control.

Technical Details

Return Value: A string value representing the maximum allowed value.

Browser Support

The numbers in the table indicate the first browser version that fully supports this attribute.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support Support Support