EN
Este conteúdo não está disponível em seu idioma, mas aqui está a versão em inglês.

max attribute | max property

Defines the maximum acceptable value for an input element with type="number".When used with the min and step attributes, lets you control the range and increment (such as only even numbers) that the user can enter into an input field.

This property is read/write.

HTML5 A vocabulary and associated APIs for HTML and XHTML, Section 4.10

Syntax

HTML
<element max="sMax" ... >
JavaScript
object.max = sMax
sMax = object.max

Property values

Type: DOMString

A string containing the maximum numeric value the field accepts.

Standards information

Remarks

The following example shows the use of the min, max, and step attributes.

Note  For more code samples, see Form controls part 1 and Form controls part 2: validation on the a Windows Store app using JavaScript sample site.

Examples


<form>
<label>
Enter an even number between 0 and 100: <input title="Enter an even number" type="number" min="0" max="100" step="2"> <input type="submit">
</label>


See also

HTMLInputElement
input type=range
Min
Step

 

 

Mostrar:
© 2014 Microsoft