Annotation of html5/spec/common-input-element-attributes.html, revision 1.230

1.154     mike        1: <!DOCTYPE html>
1.225     sruby       2: <html lang="en-US-x-Hixie"><head><title>4.10.7.3 Common input element attributes &#8212; HTML5</title><style type="text/css">
1.1       mike        3:    pre { margin-left: 2em; white-space: pre-wrap; }
                      4:    h2 { margin: 3em 0 1em 0; }
                      5:    h3 { margin: 2.5em 0 1em 0; }
                      6:    h4 { margin: 2.5em 0 0.75em 0; }
                      7:    h5, h6 { margin: 2.5em 0 1em; }
                      8:    h1 + h2, h1 + h2 + h2 { margin: 0.75em 0 0.75em; }
                      9:    h2 + h3, h3 + h4, h4 + h5, h5 + h6 { margin-top: 0.5em; }
                     10:    p { margin: 1em 0; }
                     11:    hr:not(.top) { display: block; background: none; border: none; padding: 0; margin: 2em 0; height: auto; }
                     12:    dl, dd { margin-top: 0; margin-bottom: 0; }
                     13:    dt { margin-top: 0.75em; margin-bottom: 0.25em; clear: left; }
                     14:    dt + dt { margin-top: 0; }
                     15:    dd dt { margin-top: 0.25em; margin-bottom: 0; }
                     16:    dd p { margin-top: 0; }
                     17:    dd dl + p { margin-top: 1em; }
                     18:    dd table + p { margin-top: 1em; }
                     19:    p + * > li, dd li { margin: 1em 0; }
                     20:    dt, dfn { font-weight: bold; font-style: normal; }
1.52      mike       21:    i, em { font-style: italic; }
1.1       mike       22:    dt dfn { font-style: italic; }
                     23:    pre, code { font-size: inherit; font-family: monospace; font-variant: normal; }
                     24:    pre strong { color: black; font: inherit; font-weight: bold; background: yellow; }
                     25:    pre em { font-weight: bolder; font-style: normal; }
                     26:    @media screen { code { color: orangered; } code :link, code :visited { color: inherit; } }
                     27:    var sub { vertical-align: bottom; font-size: smaller; position: relative; top: 0.1em; }
                     28:    table { border-collapse: collapse; border-style: hidden hidden none hidden; }
                     29:    table thead, table tbody { border-bottom: solid; }
                     30:    table tbody th:first-child { border-left: solid; }
                     31:    table tbody th { text-align: left; }
                     32:    table td, table th { border-left: solid; border-right: solid; border-bottom: solid thin; vertical-align: top; padding: 0.2em; }
                     33:    blockquote { margin: 0 0 0 2em; border: 0; padding: 0; font-style: italic; }
                     34: 
                     35:    .bad, .bad *:not(.XXX) { color: gray; border-color: gray; background: transparent; }
                     36:    .matrix, .matrix td { border: none; text-align: right; }
                     37:    .matrix { margin-left: 2em; }
                     38:    .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
                     39:    .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
                     40:    .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
                     41: 
                     42:    .toc dfn, h1 dfn, h2 dfn, h3 dfn, h4 dfn, h5 dfn, h6 dfn { font: inherit; }
1.56      mike       43:    img.extra, p.overview { float: right; }
1.55      mike       44:    pre.idl { border: solid thin; background: #EEEEEE; color: black; padding: 0.5em 1em; position: relative; }
1.1       mike       45:    pre.idl :link, pre.idl :visited { color: inherit; background: transparent; }
1.55      mike       46:    pre.idl::before { content: "IDL"; font: bold small sans-serif; padding: 0.5em; background: white; position: absolute; top: 0; margin: -1px 0 0 -4em; width: 1.5em; border: thin solid; border-radius: 0 0 0 0.5em }
1.1       mike       47:    pre.css { border: solid thin; background: #FFFFEE; color: black; padding: 0.5em 1em; }
                     48:    pre.css:first-line { color: #AAAA50; }
                     49:    dl.domintro { color: green; margin: 2em 0 2em 2em; padding: 0.5em 1em; border: none; background: #DDFFDD; }
                     50:    hr + dl.domintro, div.impl + dl.domintro { margin-top: 2.5em; margin-bottom: 1.5em; }
                     51:    dl.domintro dt, dl.domintro dt * { color: black; text-decoration: none; }
                     52:    dl.domintro dd { margin: 0.5em 0 1em 2em; padding: 0; }
                     53:    dl.domintro dd p { margin: 0.5em 0; }
1.63      mike       54:    dl.domintro:before { display: table; margin: -1em -0.5em -0.5em auto; width: auto; content: 'This box is non-normative. Implementation requirements are given below this box.'; color: black; font-style: italic; border: solid 2px; background: white; padding: 0 0.25em; }
1.1       mike       55:    dl.switch { padding-left: 2em; }
                     56:    dl.switch > dt { text-indent: -1.5em; }
                     57:    dl.switch > dt:before { content: '\21AA'; padding: 0 0.5em 0 0; display: inline-block; width: 1em; text-align: right; line-height: 0.5em; }
                     58:    dl.triple { padding: 0 0 0 1em; }
                     59:    dl.triple dt, dl.triple dd { margin: 0; display: inline }
                     60:    dl.triple dt:after { content: ':'; }
                     61:    dl.triple dd:after { content: '\A'; white-space: pre; }
                     62:    .diff-old { text-decoration: line-through; color: silver; background: transparent; }
                     63:    .diff-chg, .diff-new { text-decoration: underline; color: green; background: transparent; }
                     64:    a .diff-new { border-bottom: 1px blue solid; }
                     65: 
                     66:    h2 { page-break-before: always; }
                     67:    h1, h2, h3, h4, h5, h6 { page-break-after: avoid; }
                     68:    h1 + h2, hr + h2.no-toc { page-break-before: auto; }
                     69: 
1.20      mike       70:    p  > span:not([title=""]):not([class="XXX"]):not([class="impl"]):not([class="note"]),
                     71:    li > span:not([title=""]):not([class="XXX"]):not([class="impl"]):not([class="note"]), { border-bottom: solid #9999CC; }
1.1       mike       72: 
                     73:    div.head { margin: 0 0 1em; padding: 1em 0 0 0; }
                     74:    div.head p { margin: 0; }
                     75:    div.head h1 { margin: 0; }
                     76:    div.head .logo { float: right; margin: 0 1em; }
                     77:    div.head .logo img { border: none } /* remove border from top image */
                     78:    div.head dl { margin: 1em 0; }
                     79:    div.head p.copyright, div.head p.alt { font-size: x-small; font-style: oblique; margin: 0; }
                     80: 
                     81:    body > .toc > li { margin-top: 1em; margin-bottom: 1em; }
                     82:    body > .toc.brief > li { margin-top: 0.35em; margin-bottom: 0.35em; }
                     83:    body > .toc > li > * { margin-bottom: 0.5em; }
                     84:    body > .toc > li > * > li > * { margin-bottom: 0.25em; }
                     85:    .toc, .toc li { list-style: none; }
                     86: 
                     87:    .brief { margin-top: 1em; margin-bottom: 1em; line-height: 1.1; }
                     88:    .brief li { margin: 0; padding: 0; }
                     89:    .brief li p { margin: 0; padding: 0; }
                     90: 
                     91:    .category-list { margin-top: -0.75em; margin-bottom: 1em; line-height: 1.5; }
                     92:    .category-list::before { content: '\21D2\A0'; font-size: 1.2em; font-weight: 900; }
                     93:    .category-list li { display: inline; }
                     94:    .category-list li:not(:last-child)::after { content: ', '; }
                     95:    .category-list li > span, .category-list li > a { text-transform: lowercase; }
                     96:    .category-list li * { text-transform: none; } /* don't affect <code> nested in <a> */
                     97: 
                     98:    .XXX { color: #E50000; background: white; border: solid red; padding: 0.5em; margin: 1em 0; }
                     99:    .XXX > :first-child { margin-top: 0; }
                    100:    p .XXX { line-height: 3em; }
                    101:    .annotation { border: solid thin black; background: #0C479D; color: white; position: relative; margin: 8px 0 20px 0; }
                    102:    .annotation:before { position: absolute; left: 0; top: 0; width: 100%; height: 100%; margin: 6px -6px -6px 6px; background: #333333; z-index: -1; content: ''; }
                    103:    .annotation :link, .annotation :visited { color: inherit; }
                    104:    .annotation :link:hover, .annotation :visited:hover { background: transparent; }
                    105:    .annotation span { border: none ! important; }
                    106:    .note { color: green; background: transparent; font-family: sans-serif; }
                    107:    .warning { color: red; background: transparent; }
                    108:    .note, .warning { font-weight: bolder; font-style: italic; }
1.52      mike      109:    .note em, .warning em, .note i, .warning i { font-style: normal; }
1.1       mike      110:    p.note, div.note { padding: 0.5em 2em; }
                    111:    span.note { padding: 0 2em; }
                    112:    .note p:first-child, .warning p:first-child { margin-top: 0; }
                    113:    .note p:last-child, .warning p:last-child { margin-bottom: 0; }
                    114:    .warning:before { font-style: normal; }
                    115:    p.note:before { content: 'Note: '; }
                    116:    p.warning:before { content: '\26A0 Warning! '; }
                    117: 
                    118:    .bookkeeping:before { display: block; content: 'Bookkeeping details'; font-weight: bolder; font-style: italic; }
                    119:    .bookkeeping { font-size: 0.8em; margin: 2em 0; }
                    120:    .bookkeeping p { margin: 0.5em 2em; display: list-item; list-style: square; }
1.10      mike      121:    .bookkeeping dt { margin: 0.5em 2em 0; }
                    122:    .bookkeeping dd { margin: 0 3em 0.5em; }
1.1       mike      123: 
                    124:    h4 { position: relative; z-index: 3; }
                    125:    h4 + .element, h4 + div + .element { margin-top: -2.5em; padding-top: 2em; }
                    126:    .element {
                    127:      background: #EEEEFF;
                    128:      color: black;
                    129:      margin: 0 0 1em 0.15em;
                    130:      padding: 0 1em 0.25em 0.75em;
                    131:      border-left: solid #9999FF 0.25em;
                    132:      position: relative;
                    133:      z-index: 1;
                    134:    }
                    135:    .element:before {
                    136:      position: absolute;
                    137:      z-index: 2;
                    138:      top: 0;
                    139:      left: -1.15em;
                    140:      height: 2em;
                    141:      width: 0.9em;
                    142:      background: #EEEEFF;
                    143:      content: ' ';
                    144:      border-style: none none solid solid;
                    145:      border-color: #9999FF;
                    146:      border-width: 0.25em;
                    147:    }
                    148: 
                    149:    .example { display: block; color: #222222; background: #FCFCFC; border-left: double; margin-left: 2em; padding-left: 1em; }
                    150:    td > .example:only-child { margin: 0 0 0 0.1em; }
                    151: 
                    152:    ul.domTree, ul.domTree ul { padding: 0 0 0 1em; margin: 0; }
                    153:    ul.domTree li { padding: 0; margin: 0; list-style: none; position: relative; }
                    154:    ul.domTree li li { list-style: none; }
                    155:    ul.domTree li:first-child::before { position: absolute; top: 0; height: 0.6em; left: -0.75em; width: 0.5em; border-style: none none solid solid; content: ''; border-width: 0.1em; }
                    156:    ul.domTree li:not(:last-child)::after { position: absolute; top: 0; bottom: -0.6em; left: -0.75em; width: 0.5em; border-style: none none solid solid; content: ''; border-width: 0.1em; }
                    157:    ul.domTree span { font-style: italic; font-family: serif; }
                    158:    ul.domTree .t1 code { color: purple; font-weight: bold; }
                    159:    ul.domTree .t2 { font-style: normal; font-family: monospace; }
                    160:    ul.domTree .t2 .name { color: black; font-weight: bold; }
                    161:    ul.domTree .t2 .value { color: blue; font-weight: normal; }
                    162:    ul.domTree .t3 code, .domTree .t4 code, .domTree .t5 code { color: gray; }
                    163:    ul.domTree .t7 code, .domTree .t8 code { color: green; }
                    164:    ul.domTree .t10 code { color: teal; }
                    165: 
                    166:    body.dfnEnabled dfn { cursor: pointer; }
                    167:    .dfnPanel {
                    168:      display: inline;
                    169:      position: absolute;
                    170:      z-index: 10;
                    171:      height: auto;
                    172:      width: auto;
                    173:      padding: 0.5em 0.75em;
                    174:      font: small sans-serif, Droid Sans Fallback;
                    175:      background: #DDDDDD;
                    176:      color: black;
                    177:      border: outset 0.2em;
                    178:    }
                    179:    .dfnPanel * { margin: 0; padding: 0; font: inherit; text-indent: 0; }
                    180:    .dfnPanel :link, .dfnPanel :visited { color: black; }
                    181:    .dfnPanel p { font-weight: bolder; }
                    182:    .dfnPanel * + p { margin-top: 0.25em; }
                    183:    .dfnPanel li { list-style-position: inside; }
                    184: 
                    185:    #configUI { position: absolute; z-index: 20; top: 10em; right: 1em; width: 11em; font-size: small; }
                    186:    #configUI p { margin: 0.5em 0; padding: 0.3em; background: #EEEEEE; color: black; border: inset thin; }
                    187:    #configUI p label { display: block; }
                    188:    #configUI #updateUI, #configUI .loginUI { text-align: center; }
                    189:    #configUI input[type=button] { display: block; margin: auto; }
1.8       mike      190: 
1.24      mike      191:    fieldset { margin: 1em; padding: 0.5em 1em; }
                    192:    fieldset > legend + * { margin-top: 0; }
1.19      mike      193:    fieldset > :last-child { margin-bottom: 0; }
1.24      mike      194:    fieldset p { margin: 0.5em 0; }
                    195: 
1.225     sruby     196:   </style><link href="http://www.w3.org/StyleSheets/TR/W3C-ED" rel="stylesheet" type="text/css"><style type="text/css">
1.1       mike      197: 
                    198:    .applies thead th > * { display: block; }
                    199:    .applies thead code { display: block; }
                    200:    .applies tbody th { whitespace: nowrap; }
                    201:    .applies td { text-align: center; }
                    202:    .applies .yes { background: yellow; }
                    203: 
1.11      mike      204:    .matrix, .matrix td { border: hidden; text-align: right; }
1.1       mike      205:    .matrix { margin-left: 2em; }
                    206: 
                    207:    .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
                    208:    .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
                    209:    .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
                    210: 
1.16      mike      211:    td.eg { border-width: thin; text-align: center; }
                    212: 
1.1       mike      213:    #table-example-1 { border: solid thin; border-collapse: collapse; margin-left: 3em; }
                    214:    #table-example-1 * { font-family: "Essays1743", serif; line-height: 1.01em; }
                    215:    #table-example-1 caption { padding-bottom: 0.5em; }
                    216:    #table-example-1 thead, #table-example-1 tbody { border: none; }
                    217:    #table-example-1 th, #table-example-1 td { border: solid thin; }
                    218:    #table-example-1 th { font-weight: normal; }
                    219:    #table-example-1 td { border-style: none solid; vertical-align: top; }
                    220:    #table-example-1 th { padding: 0.5em; vertical-align: middle; text-align: center; }
                    221:    #table-example-1 tbody tr:first-child td { padding-top: 0.5em; }
                    222:    #table-example-1 tbody tr:last-child td { padding-bottom: 1.5em; }
                    223:    #table-example-1 tbody td:first-child { padding-left: 2.5em; padding-right: 0; width: 9em; }
                    224:    #table-example-1 tbody td:first-child::after { content: leader(". "); }
                    225:    #table-example-1 tbody td { padding-left: 2em; padding-right: 2em; }
                    226:    #table-example-1 tbody td:first-child + td { width: 10em; }
                    227:    #table-example-1 tbody td:first-child + td ~ td { width: 2.5em; }
                    228:    #table-example-1 tbody td:first-child + td + td + td ~ td { width: 1.25em; }
                    229: 
                    230:    .apple-table-examples { border: none; border-collapse: separate; border-spacing: 1.5em 0em; width: 40em; margin-left: 3em; }
                    231:    .apple-table-examples * { font-family: "Times", serif; }
                    232:    .apple-table-examples td, .apple-table-examples th { border: none; white-space: nowrap; padding-top: 0; padding-bottom: 0; }
                    233:    .apple-table-examples tbody th:first-child { border-left: none; width: 100%; }
                    234:    .apple-table-examples thead th:first-child ~ th { font-size: smaller; font-weight: bolder; border-bottom: solid 2px; text-align: center; }
                    235:    .apple-table-examples tbody th::after, .apple-table-examples tfoot th::after { content: leader(". ") }
                    236:    .apple-table-examples tbody th, .apple-table-examples tfoot th { font: inherit; text-align: left; }
                    237:    .apple-table-examples td { text-align: right; vertical-align: top; }
                    238:    .apple-table-examples.e1 tbody tr:last-child td { border-bottom: solid 1px; }
                    239:    .apple-table-examples.e1 tbody + tbody tr:last-child td { border-bottom: double 3px; }
                    240:    .apple-table-examples.e2 th[scope=row] { padding-left: 1em; }
                    241:    .apple-table-examples sup { line-height: 0; }
                    242: 
                    243:    .details-example img { vertical-align: top; }
                    244: 
1.32      mike      245:    #base64-table {
                    246:      white-space: nowrap;
                    247:      font-size: 0.6em;
                    248:      column-width: 6em;
                    249:      column-count: 5;
                    250:      column-gap: 1em;
                    251:      -moz-column-width: 6em;
                    252:      -moz-column-count: 5;
                    253:      -moz-column-gap: 1em;
                    254:      -webkit-column-width: 6em;
                    255:      -webkit-column-count: 5;
                    256:      -webkit-column-gap: 1em;
                    257:    }
                    258:    #base64-table thead { display: none; }
                    259:    #base64-table * { border: none; }
                    260:    #base64-table tbody td:first-child:after { content: ':'; }
                    261:    #base64-table tbody td:last-child { text-align: right; }
                    262: 
1.1       mike      263:    #named-character-references-table {
1.18      mike      264:      white-space: nowrap;
1.1       mike      265:      font-size: 0.6em;
1.18      mike      266:      column-width: 30em;
1.1       mike      267:      column-gap: 1em;
1.18      mike      268:      -moz-column-width: 30em;
1.1       mike      269:      -moz-column-gap: 1em;
1.18      mike      270:      -webkit-column-width: 30em;
1.1       mike      271:      -webkit-column-gap: 1em;
                    272:    }
1.18      mike      273:    #named-character-references-table > table > tbody > tr > td:first-child + td,
1.1       mike      274:    #named-character-references-table > table > tbody > tr > td:last-child { text-align: center; }
                    275:    #named-character-references-table > table > tbody > tr > td:last-child:hover > span { position: absolute; top: auto; left: auto; margin-left: 0.5em; line-height: 1.2; font-size: 5em; border: outset; padding: 0.25em 0.5em; background: white; width: 1.25em; height: auto; text-align: center; }
1.18      mike      276:    #named-character-references-table > table > tbody > tr#entity-CounterClockwiseContourIntegral > td:first-child { font-size: 0.5em; }
1.1       mike      277: 
1.2       mike      278:    .glyph.control { color: red; }
                    279: 
1.4       mike      280:    @font-face {
                    281:      font-family: 'Essays1743';
                    282:      src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743.ttf');
                    283:    }
                    284:    @font-face {
                    285:      font-family: 'Essays1743';
                    286:      font-weight: bold;
                    287:      src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Bold.ttf');
                    288:    }
                    289:    @font-face {
                    290:      font-family: 'Essays1743';
                    291:      font-style: italic;
                    292:      src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Italic.ttf');
                    293:    }
                    294:    @font-face {
                    295:      font-family: 'Essays1743';
                    296:      font-style: italic;
                    297:      font-weight: bold;
                    298:      src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-BoldItalic.ttf');
                    299:    }
                    300: 
1.225     sruby     301:   </style><link href="data:text/css," id="complete" rel="stylesheet" title="Complete specification"><link href="data:text/css,.impl%20%7B%20display:%20none;%20%7D%0Ahtml%20%7B%20border:%20solid%20yellow;%20%7D%20.domintro:before%20%7B%20display:%20none;%20%7D" id="author" rel="alternate stylesheet" title="Author documentation only"><link href="data:text/css,.impl%20%7B%20background:%20%23FFEEEE;%20%7D%20.domintro:before%20%7B%20background:%20%23FFEEEE;%20%7D" id="highlight" rel="alternate stylesheet" title="Highlight implementation requirements"><script>
1.38      mike      302:    function getCookie(name) {
                    303:      var params = location.search.substr(1).split("&");
                    304:      for (var index = 0; index < params.length; index++) {
                    305:        if (params[index] == name)
                    306:          return "1";
                    307:        var data = params[index].split("=");
                    308:        if (data[0] == name)
                    309:          return unescape(data[1]);
                    310:      }
                    311:      var cookies = document.cookie.split("; ");
                    312:      for (var index = 0; index < cookies.length; index++) {
                    313:        var data = cookies[index].split("=");
                    314:        if (data[0] == name)
                    315:          return unescape(data[1]);
                    316:      }
                    317:      return null;
                    318:    }
1.225     sruby     319:   </script><link href="states-of-the-type-attribute.html" title="4.10.7.1 States of the type attribute" rel="prev">
1.227     sruby     320:   <link href="spec.html#contents" title="Table of contents" rel="contents">
1.99      mike      321:   <link href="common-input-element-apis.html" title="4.10.7.4 Common input element APIs" rel="next">
1.88      mike      322:   </head><body onload="fixBrokenLink();" class="split chapter"><div class="head" id="head">
1.1       mike      323:    <p><a href="http://www.w3.org/"><img alt="W3C" height="48" src="http://www.w3.org/Icons/w3c_home" width="72"></a></p>
1.3       mike      324: 
1.1       mike      325:    <h1>HTML5</h1>
1.225     sruby     326:    <h2 class="no-num no-toc" id="a-vocabulary-and-associated-apis-for-html-and-xhtml">A vocabulary and associated APIs for HTML and XHTML</h2>
1.230   ! sruby     327:    <h2 class="no-num no-toc" id="editor's-draft-date-1-january-1970">Editor's Draft 1 September 2012</h2>
1.151     mike      328:    </div>
                    329: 
1.225     sruby     330:   <div class="prev_next">
1.74      mike      331:    <a href="states-of-the-type-attribute.html">&#8592; 4.10.7.1 States of the type attribute</a> &#8211;
1.227     sruby     332:    <a href="spec.html#contents">Table of contents</a> &#8211;
1.99      mike      333:    <a href="common-input-element-apis.html">4.10.7.4 Common input element APIs &#8594;</a>
                    334:   <ol class="toc"><li><ol><li><ol><li><ol><li><a href="common-input-element-attributes.html#common-input-element-attributes"><span class="secno">4.10.7.3 </span>Common <code>input</code> element attributes</a>
1.225     sruby     335:         <ol><li><a href="common-input-element-attributes.html#the-autocomplete-attribute"><span class="secno">4.10.7.3.1 </span>The <code title="attr-input-autocomplete">autocomplete</code> attribute</a></li><li><a href="common-input-element-attributes.html#the-dirname-attribute"><span class="secno">4.10.7.3.2 </span>The <code title="attr-input-dirname">dirname</code> attribute</a></li><li><a href="common-input-element-attributes.html#the-list-attribute"><span class="secno">4.10.7.3.3 </span>The <code title="attr-input-list">list</code> attribute</a></li><li><a href="common-input-element-attributes.html#the-readonly-attribute"><span class="secno">4.10.7.3.4 </span>The <code title="attr-input-readonly">readonly</code> attribute</a></li><li><a href="common-input-element-attributes.html#the-size-attribute"><span class="secno">4.10.7.3.5 </span>The <code title="attr-input-size">size</code> attribute</a></li><li><a href="common-input-element-attributes.html#the-required-attribute"><span class="secno">4.10.7.3.6 </span>The <code title="attr-input-required">required</code> attribute</a></li><li><a href="common-input-element-attributes.html#the-multiple-attribute"><span class="secno">4.10.7.3.7 </span>The <code title="attr-input-multiple">multiple</code> attribute</a></li><li><a href="common-input-element-attributes.html#the-maxlength-attribute"><span class="secno">4.10.7.3.8 </span>The <code title="attr-input-maxlength">maxlength</code> attribute</a></li><li><a href="common-input-element-attributes.html#the-pattern-attribute"><span class="secno">4.10.7.3.9 </span>The <code title="attr-input-pattern">pattern</code> attribute</a></li><li><a href="common-input-element-attributes.html#the-min-and-max-attributes"><span class="secno">4.10.7.3.10 </span>The <code title="attr-input-min">min</code> and <code title="attr-input-max">max</code> attributes</a></li><li><a href="common-input-element-attributes.html#the-step-attribute"><span class="secno">4.10.7.3.11 </span>The <code title="attr-input-step">step</code> attribute</a></li><li><a href="common-input-element-attributes.html#the-placeholder-attribute"><span class="secno">4.10.7.3.12 </span>The <code title="attr-input-placeholder">placeholder</code> attribute</a></li></ol></li></ol></li></ol></li></ol></li></ol></div>
1.1       mike      336: 
1.151     mike      337:   <h5 id="common-input-element-attributes"><span class="secno">4.10.7.3 </span>Common <code><a href="the-input-element.html#the-input-element">input</a></code> element attributes</h5>
                    338: 
                    339:   <div class="impl">
1.1       mike      340: 
                    341:   <p>These attributes only apply to an <code><a href="the-input-element.html#the-input-element">input</a></code> element if
                    342:   its <code title="attr-input-type"><a href="the-input-element.html#attr-input-type">type</a></code> attribute is in a
                    343:   state whose definition declares that the attribute applies. When an
1.85      mike      344:   attribute <dfn id="do-not-apply" title="do not apply">doesn't apply</dfn> to an
                    345:   <code><a href="the-input-element.html#the-input-element">input</a></code> element, user agents must <a href="infrastructure.html#ignore">ignore</a> the
                    346:   attribute, regardless of the requirements and definitions
                    347:   below.</p>
1.1       mike      348: 
1.151     mike      349:   </div>
                    350: 
                    351: 
                    352:   <h6 id="the-autocomplete-attribute"><span class="secno">4.10.7.3.1 </span>The <code title="attr-input-autocomplete"><a href="#attr-input-autocomplete">autocomplete</a></code> attribute</h6>
                    353: 
                    354:   <p>User agents sometimes have features for helping users fill forms
1.1       mike      355:   in, for example prefilling the user's address based on earlier user
1.151     mike      356:   input.</p>
                    357: 
                    358:   <p>The <dfn id="attr-input-autocomplete" title="attr-input-autocomplete"><code>autocomplete</code></dfn>
1.1       mike      359:   attribute is an <a href="common-microsyntaxes.html#enumerated-attribute">enumerated attribute</a>. The attribute has
                    360:   three states. The <code title="attr-input-autocomplete-on">on</code>
                    361:   keyword maps to the <dfn id="attr-input-autocomplete-on-state" title="attr-input-autocomplete-on-state">on</dfn> state, and the
                    362:   <code title="attr-input-autocomplete-off">off</code> keyword maps to
                    363:   the <dfn id="attr-input-autocomplete-off-state" title="attr-input-autocomplete-off-state">off</dfn>
                    364:   state. The attribute may also be omitted. The <i>missing value
                    365:   default</i> is the <dfn id="attr-input-autocomplete-default-state" title="attr-input-autocomplete-default-state">default</dfn>
1.151     mike      366:   state.</p>
                    367: 
                    368:   <p>The <a href="#attr-input-autocomplete-off-state" title="attr-input-autocomplete-off-state">off</a>
1.1       mike      369:   state indicates either that the control's input data is particularly
                    370:   sensitive (for example the activation code for a nuclear weapon); or
                    371:   that it is a value that will never be reused (for example a
                    372:   one-time-key for a bank login) and the user will therefore have to
                    373:   explicitly enter the data each time, instead of being able to rely
                    374:   on the UA to prefill the value for him; or that the document
                    375:   provides its own autocomplete mechanism and does not want the user
1.151     mike      376:   agent to provide autocompletion values.</p>
                    377: 
                    378:   <p>Conversely, the <a href="#attr-input-autocomplete-on-state" title="attr-input-autocomplete-on-state">on</a> state indicates
1.1       mike      379:   that the value is not particularly sensitive and the user can expect
                    380:   to be able to rely on his user agent to remember values he has
1.151     mike      381:   entered for that control.</p>
                    382: 
                    383:   <p>The <a href="#attr-input-autocomplete-default-state" title="attr-input-autocomplete-default-state">default</a> state
1.67      mike      384:   indicates that the user agent is to use the <code title="attr-form-autocomplete"><a href="the-form-element.html#attr-form-autocomplete">autocomplete</a></code> attribute on the
                    385:   element's <a href="association-of-controls-and-forms.html#form-owner">form owner</a> instead. (By default, the <code title="attr-form-autocomplete"><a href="the-form-element.html#attr-form-autocomplete">autocomplete</a></code> attribute of
1.151     mike      386:   <code><a href="the-form-element.html#the-form-element">form</a></code> elements is in the <a href="the-form-element.html#attr-form-autocomplete-on-state" title="attr-form-autocomplete-on-state">on</a> state.)</p>
                    387: 
                    388:   <div class="impl">
1.1       mike      389: 
                    390:   <p>Each <code><a href="the-input-element.html#the-input-element">input</a></code> element has a <dfn id="resulting-autocompletion-state">resulting
                    391:   autocompletion state</dfn>, which is either <i title="">on</i> or <i title="">off</i>.</p>
                    392: 
                    393:   <p>When an <code><a href="the-input-element.html#the-input-element">input</a></code> element is in one of the following
                    394:   conditions, the <code><a href="the-input-element.html#the-input-element">input</a></code> element's <a href="#resulting-autocompletion-state">resulting
                    395:   autocompletion state</a> is <i title="">on</i>; otherwise, the
                    396:   <code><a href="the-input-element.html#the-input-element">input</a></code> element's <a href="#resulting-autocompletion-state">resulting autocompletion
                    397:   state</a> is <i title="">off</i>:</p>
                    398: 
                    399:   <ul class="brief"><li>Its <code title="attr-input-autocomplete"><a href="#attr-input-autocomplete">autocomplete</a></code>
                    400:    attribute is in the <a href="#attr-input-autocomplete-on-state" title="attr-input-autocomplete-on-state">on</a> state.</li>
                    401: 
                    402:    <li>Its <code title="attr-input-autocomplete"><a href="#attr-input-autocomplete">autocomplete</a></code>
                    403:    attribute is in the <a href="#attr-input-autocomplete-default-state" title="attr-input-autocomplete-default-state">default</a> state,
                    404:    and the element has no <a href="association-of-controls-and-forms.html#form-owner">form owner</a>.</li>
                    405: 
                    406:    <li>Its <code title="attr-input-autocomplete"><a href="#attr-input-autocomplete">autocomplete</a></code>
                    407:    attribute is in the <a href="#attr-input-autocomplete-default-state" title="attr-input-autocomplete-default-state">default</a> state,
1.67      mike      408:    and the element's <a href="association-of-controls-and-forms.html#form-owner">form owner</a>'s <code title="attr-form-autocomplete"><a href="the-form-element.html#attr-form-autocomplete">autocomplete</a></code> attribute is in
                    409:    the <a href="the-form-element.html#attr-form-autocomplete-on-state" title="attr-form-autocomplete-on-state">on</a>
1.1       mike      410:    state.</li>
                    411: 
                    412:   </ul><p>When an <code><a href="the-input-element.html#the-input-element">input</a></code> element's <a href="#resulting-autocompletion-state">resulting
                    413:   autocompletion state</a> is <i title="">on</i>, the user agent
                    414:   may store the value entered by the user so that if the user returns
                    415:   to the page, the UA can prefill the form. Otherwise, the user agent
1.67      mike      416:   should not remember the control's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a>, and should not offer past
1.1       mike      417:   values to the user.</p>
                    418: 
                    419:   <p>In addition, if the <a href="#resulting-autocompletion-state">resulting autocompletion state</a>
                    420:   is <i title="">off</i>, <a href="history.html#history-autocomplete">values are
                    421:   reset</a> when <a href="history.html#traverse-the-history" title="traverse the history">traversing the
                    422:   history</a>.</p>
                    423: 
                    424:   <p>The autocompletion mechanism must be implemented by the user
1.67      mike      425:   agent acting as if the user had modified the element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a>, and must be done at a time
1.1       mike      426:   where the element is <i title="concept-input-mutable"><a href="the-input-element.html#concept-input-mutable">mutable</a></i>
                    427:   (e.g. just after the element has been inserted into the document, or
1.58      mike      428:   when the user agent <a href="the-end.html#stop-parsing" title="stop parsing">stops
1.1       mike      429:   parsing</a>).</p>
                    430: 
1.151     mike      431:   </div>
                    432: 
                    433:   <div class="example">
1.1       mike      434: 
                    435:    <p>Banks frequently do not want UAs to prefill login
                    436:    information:</p>
                    437: 
                    438:    <pre>&lt;p&gt;&lt;label&gt;Account: &lt;input type="text" name="ac" autocomplete="off"&gt;&lt;/label&gt;&lt;/p&gt;
                    439: &lt;p&gt;&lt;label&gt;PIN: &lt;input type="password" name="pin" autocomplete="off"&gt;&lt;/label&gt;&lt;/p&gt;</pre>
                    440: 
1.151     mike      441:   </div>
                    442: 
                    443:   <div class="impl">
1.1       mike      444: 
                    445:   <p>A user agent may allow the user to override the <a href="#resulting-autocompletion-state">resulting
                    446:   autocompletion state</a> and set it to always <i title="">on</i>,
1.60      mike      447:   always allowing values to be remembered and prefilled, or always <i title="">off</i>, never remembering values. However, user agents
                    448:   should not allow users to trivially override the <a href="#resulting-autocompletion-state">resulting
                    449:   autocompletion state</a> to <i title="">on</i>, as there are
1.1       mike      450:   significant security implications for the user if all values are
                    451:   always remembered, regardless of the site's preferences.</p>
                    452: 
1.151     mike      453:   </div>
                    454: 
                    455: 
                    456:   <h6 id="the-dirname-attribute"><span class="secno">4.10.7.3.2 </span>The <code title="attr-input-dirname"><a href="#attr-input-dirname">dirname</a></code> attribute</h6>
                    457: 
                    458:   <p>The <dfn id="attr-input-dirname" title="attr-input-dirname"><code>dirname</code></dfn>
1.225     sruby     459:   attribute, when it applies, is a <a href="form-submission.html#form-control-dirname-attribute">form control <code title="">dirname</code> attribute</a>.</p>
1.151     mike      460: 
                    461:   <div class="example">
1.25      mike      462: 
                    463:    <p>In this example, a form contains a text field and a submission
                    464:    button:</p>
                    465: 
                    466:    <pre>&lt;form action="addcomment.cgi" method=post&gt;
                    467:  &lt;p&gt;&lt;label&gt;Comment: &lt;input type=text name="comment" dirname="comment.dir" required&gt;&lt;/label&gt;&lt;/p&gt;
                    468:  &lt;p&gt;&lt;button name="mode" type=submit value="add"&gt;Post Comment&lt;/button&gt;&lt;/p&gt;
                    469: &lt;/form&gt;</pre>
                    470: 
                    471:    <p>When the user submits the form, the user agent includes three
                    472:    fields, one called "comment", one called "comment.dir", and one
                    473:    called "mode"; so if the user types "Hello", the submission body
                    474:    might be something like:</p>
                    475: 
                    476:    <pre>comment=Hello&amp;<strong>comment.dir=ltr</strong>&amp;mode=add</pre>
                    477: 
                    478:    <p>If the user manually switches to a right-to-left writing
                    479:    direction and enters "<span dir="rtl" lang="ar" title="">&#1605;&#1585;&#1581;&#1576;&#1611;&#1575;</span>", the
                    480:    submission body might be something like:</p>
                    481: 
                    482:    <pre>comment=%D9%85%D8%B1%D8%AD%D8%A8%D9%8B%D8%A7&amp;<strong>comment.dir=rtl</strong>&amp;mode=add</pre>
                    483: 
1.151     mike      484:   </div>
                    485: 
                    486: 
                    487:   <h6 id="the-list-attribute"><span class="secno">4.10.7.3.3 </span>The <code title="attr-input-list"><a href="#attr-input-list">list</a></code> attribute</h6>
                    488: 
                    489:   <p>The <dfn id="attr-input-list" title="attr-input-list"><code>list</code></dfn>
1.1       mike      490:   attribute is used to identify an element that lists predefined
1.151     mike      491:   options suggested to the user.</p>
                    492: 
                    493:   <p>If present, its value must be the <a href="infrastructure.html#concept-id" title="concept-id">ID</a> of a <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code> element in
                    494:   the same document.</p>
                    495: 
                    496:   <div class="impl">
1.1       mike      497: 
                    498:   <p>The <dfn id="concept-input-list" title="concept-input-list">suggestions source
                    499:   element</dfn> is the first element in the document in <a href="infrastructure.html#tree-order">tree
1.62      mike      500:   order</a> to have an <a href="infrastructure.html#concept-id" title="concept-id">ID</a> equal to
1.30      mike      501:   the value of the <code title="attr-input-list"><a href="#attr-input-list">list</a></code>
1.67      mike      502:   attribute, if that element is a <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code> element. If
1.30      mike      503:   there is no <code title="attr-input-list"><a href="#attr-input-list">list</a></code> attribute, or
1.62      mike      504:   if there is no element with that <a href="infrastructure.html#concept-id" title="concept-id">ID</a>,
                    505:   or if the first element with that <a href="infrastructure.html#concept-id" title="concept-id">ID</a>
1.67      mike      506:   is not a <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code> element, then there is no <a href="#concept-input-list" title="concept-input-list">suggestions source element</a>.</p>
1.1       mike      507: 
                    508:   <p>If there is a <a href="#concept-input-list" title="concept-input-list">suggestions source
                    509:   element</a>, then, when the user agent is allowing the user to
1.67      mike      510:   edit the <code><a href="the-input-element.html#the-input-element">input</a></code> element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a>, the user agent should offer
1.1       mike      511:   the suggestions represented by the <a href="#concept-input-list" title="concept-input-list">suggestions source element</a> to the
                    512:   user in a manner suitable for the type of control used. The user
1.67      mike      513:   agent may use the suggestion's <a href="the-option-element.html#concept-option-label" title="concept-option-label">label</a> to identify the suggestion
1.30      mike      514:   if appropriate.</p>
1.1       mike      515: 
1.30      mike      516:   <p>How user selections of suggestions are handled depends on whether
                    517:   the element is a control accepting a single value only, or whether
                    518:   it accepts multiple values:</p>
                    519: 
                    520:   <dl class="switch"><dt>If the element does not have a <code title="attr-input-multiple"><a href="#attr-input-multiple">multiple</a></code> attribute specified or
                    521:    if the <code title="attr-input-multiple"><a href="#attr-input-multiple">multiple</a></code> attribute
                    522:    does not apply</dt>
                    523: 
                    524:    <dd>
                    525: 
                    526:     <p>When the user selects a suggestion, the <code><a href="the-input-element.html#the-input-element">input</a></code>
1.67      mike      527:     element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a> must be set
                    528:     to the selected suggestion's <a href="the-option-element.html#concept-option-value" title="concept-option-value">value</a>, as if the user had
1.30      mike      529:     written that value himself.</p>
                    530: 
                    531:    </dd>
                    532: 
                    533:    <dt>If the element <em>does</em> have a <code title="attr-input-multiple"><a href="#attr-input-multiple">multiple</a></code> attribute specified,
                    534:    and the <code title="attr-input-multiple"><a href="#attr-input-multiple">multiple</a></code> attribute
                    535:    does apply</dt>
                    536: 
                    537:    <dd>
                    538: 
                    539:     <p>When the user selects a suggestion, the user agent must either
1.67      mike      540:     add a new entry to the <code><a href="the-input-element.html#the-input-element">input</a></code> element's <a href="attributes-common-to-form-controls.html#concept-fe-values" title="concept-fe-values">value<em>s</em></a>, whose value is
                    541:     the selected suggestion's <a href="the-option-element.html#concept-option-value" title="concept-option-value">value</a>, or change an existing
                    542:     entry in the <code><a href="the-input-element.html#the-input-element">input</a></code> element's <a href="attributes-common-to-form-controls.html#concept-fe-values" title="concept-fe-values">value<em>s</em></a> to have the value
                    543:     given by the selected suggestion's <a href="the-option-element.html#concept-option-value" title="concept-option-value">value</a>, as if the user had
1.30      mike      544:     himself added an entry with that value, or edited an existing
                    545:     entry to be that value. Which behavior is to be applied depends on
                    546:     the user interface in a user-agent-defined manner.</p>
                    547: 
                    548:    </dd>
                    549: 
                    550:   </dl><hr><p>If the <code title="attr-input-list"><a href="#attr-input-list">list</a></code> attribute does
1.1       mike      551:   not apply, there is no <a href="#concept-input-list" title="concept-input-list">suggestions
                    552:   source element</a>.</p>
                    553: 
1.151     mike      554:   </div>
                    555: 
                    556:   <div class="example">
1.1       mike      557: 
                    558:    <p>This URL field offers some suggestions.</p>
                    559: 
                    560:    <pre>&lt;label&gt;Homepage: &lt;input name=hp type=url list=hpurls&gt;&lt;/label&gt;
                    561: &lt;datalist id=hpurls&gt;
                    562:  &lt;option value="http://www.google.com/" label="Google"&gt;
                    563:  &lt;option value="http://www.reddit.com/" label="Reddit"&gt;
                    564: &lt;/datalist&gt;</pre>
                    565: 
                    566:    <p>Other URLs from the user's history might show also; this is up
                    567:    to the user agent.</p>
                    568: 
1.151     mike      569:   </div>
                    570: 
                    571:   <div class="example">
1.1       mike      572: 
                    573:    <p>This example demonstrates how to design a form that uses the
                    574:    autocompletion list feature while still degrading usefully in
                    575:    legacy user agents.</p>
                    576: 
                    577:    <p>If the autocompletion list is merely an aid, and is not
1.67      mike      578:    important to the content, then simply using a <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code>
                    579:    element with children <code><a href="the-option-element.html#the-option-element">option</a></code> elements is enough. To
1.1       mike      580:    prevent the values from being rendered in legacy user agents, they
1.67      mike      581:    need to be placed inside the <code title="attr-option-value"><a href="the-option-element.html#attr-option-value">value</a></code> attribute instead of
1.1       mike      582:    inline.</p>
                    583: 
                    584:    <pre>&lt;p&gt;
                    585:  &lt;label&gt;
                    586:   Enter a breed:
                    587:   &lt;input type="text" name="breed" list="breeds"&gt;
                    588:   &lt;datalist id="breeds"&gt;
                    589:    &lt;option value="Abyssinian"&gt;
                    590:    &lt;option value="Alpaca"&gt;
                    591:    &lt;!-- ... --&gt;
                    592:   &lt;/datalist&gt;
                    593:  &lt;/label&gt;
                    594: &lt;/p&gt;</pre>
                    595: 
                    596:    <p>However, if the values need to be shown in legacy UAs, then
1.67      mike      597:    fallback content can be placed inside the <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code>
1.1       mike      598:    element, as follows:</p>
                    599: 
                    600:    <pre>&lt;p&gt;
                    601:  &lt;label&gt;
                    602:   Enter a breed:
                    603:   &lt;input type="text" name="breed" list="breeds"&gt;
                    604:  &lt;/label&gt;
                    605:  &lt;datalist id="breeds"&gt;
                    606:   &lt;label&gt;
                    607:    or select one from the list:
                    608:    &lt;select name="breed"&gt;
                    609:     &lt;option value=""&gt; (none selected)
                    610:     &lt;option&gt;Abyssinian
                    611:     &lt;option&gt;Alpaca
                    612:     &lt;!-- ... --&gt;
                    613:    &lt;/select&gt;
                    614:   &lt;/label&gt;
                    615:  &lt;/datalist&gt;
                    616: &lt;/p&gt;
                    617: </pre>
                    618: 
                    619:    <p>The fallback content will only be shown in UAs that don't
1.67      mike      620:    support <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code>. The options, on the other hand, will
1.54      mike      621:    be detected by all UAs, even though they are not children of the
1.67      mike      622:    <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code> element.</p>
1.1       mike      623: 
1.67      mike      624:    <p>Note that if an <code><a href="the-option-element.html#the-option-element">option</a></code> element used in a
                    625:    <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code> is <code title="attr-option-selected"><a href="the-option-element.html#attr-option-selected">selected</a></code>, it will be selected
1.1       mike      626:    by default by legacy UAs (because it affects the
1.67      mike      627:    <code><a href="the-select-element.html#the-select-element">select</a></code>), but it will not have any effect on the
1.1       mike      628:    <code><a href="the-input-element.html#the-input-element">input</a></code> element in UAs that support
1.67      mike      629:    <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code>.</p>
1.1       mike      630: 
1.151     mike      631:   </div>
                    632: 
                    633: 
                    634: 
                    635:   <h6 id="the-readonly-attribute"><span class="secno">4.10.7.3.4 </span>The <code title="attr-input-readonly"><a href="#attr-input-readonly">readonly</a></code> attribute</h6>
                    636: 
                    637:   <p>The <dfn id="attr-input-readonly" title="attr-input-readonly"><code>readonly</code></dfn>
1.1       mike      638:   attribute is a <a href="common-microsyntaxes.html#boolean-attribute">boolean attribute</a> that controls whether
1.12      mike      639:   or not the user can edit the form control. <span class="impl">When
1.151     mike      640:   specified, the element is <i title="concept-input-immutable"><a href="the-input-element.html#concept-input-immutable">immutable</a></i>.</span></p>
                    641: 
                    642:   <div class="impl">
1.1       mike      643: 
                    644:   <p><strong>Constraint validation</strong>: If the <code title="attr-input-readonly"><a href="#attr-input-readonly">readonly</a></code> attribute is specified
1.67      mike      645:   on an <code><a href="the-input-element.html#the-input-element">input</a></code> element, the element is <a href="constraints.html#barred-from-constraint-validation">barred from
1.1       mike      646:   constraint validation</a>.</p>
                    647: 
1.151     mike      648:   </div>
                    649: 
                    650:   <div class="example">
1.1       mike      651: 
                    652:    <p>In the following example, the existing product identifiers
                    653:    cannot be modified, but they are still displayed as part of the
                    654:    form, for consistency with the row representing a new product
                    655:    (where the identifier is not yet filled in).</p>
                    656: 
                    657:    <pre>&lt;form action="products.cgi" method=post enctype="multipart/form-data"&gt;
                    658:  &lt;table&gt;
                    659:   &lt;tr&gt; &lt;th&gt; Product ID &lt;th&gt; Product name &lt;th&gt; Price &lt;th&gt; Action
                    660:   &lt;tr&gt;
                    661:    &lt;td&gt; &lt;input readonly name="1.pid" value="H412"&gt;
                    662:    &lt;td&gt; &lt;input required name="1.pname" value="Floor lamp Ulke"&gt;
                    663:    &lt;td&gt; $&lt;input required type=number min=0 step=0.01 name="1.pprice" value="49.99"&gt;
                    664:    &lt;td&gt; &lt;button formnovalidate name="action" value="delete:1"&gt;Delete&lt;/button&gt;
                    665:   &lt;tr&gt;
                    666:    &lt;td&gt; &lt;input readonly name="2.pid" value="FG28"&gt;
                    667:    &lt;td&gt; &lt;input required name="2.pname" value="Table lamp Ulke"&gt;
                    668:    &lt;td&gt; $&lt;input required type=number min=0 step=0.01 name="2.pprice" value="24.99"&gt;
                    669:    &lt;td&gt; &lt;button formnovalidate name="action" value="delete:2"&gt;Delete&lt;/button&gt;
                    670:   &lt;tr&gt;
                    671:    &lt;td&gt; &lt;input required name="3.pid" value="" pattern="[A-Z0-9]+"&gt;
                    672:    &lt;td&gt; &lt;input required name="3.pname" value=""&gt;
                    673:    &lt;td&gt; $&lt;input required type=number min=0 step=0.01 name="3.pprice" value=""&gt;
                    674:    &lt;td&gt; &lt;button formnovalidate name="action" value="delete:3"&gt;Delete&lt;/button&gt;
                    675:  &lt;/table&gt;
                    676:  &lt;p&gt; &lt;button formnovalidate name="action" value="add"&gt;Add&lt;/button&gt; &lt;/p&gt;
                    677:  &lt;p&gt; &lt;button name="action" value="update"&gt;Save&lt;/button&gt; &lt;/p&gt;
                    678: &lt;/form&gt;</pre>
                    679: 
1.151     mike      680:   </div>
                    681: 
                    682: 
                    683: 
                    684:   <h6 id="the-size-attribute"><span class="secno">4.10.7.3.5 </span>The <code title="attr-input-size"><a href="#attr-input-size">size</a></code> attribute</h6>
                    685: 
                    686:   <p>The <dfn id="attr-input-size" title="attr-input-size"><code>size</code></dfn>
1.1       mike      687:   attribute gives the number of characters that, in a visual
                    688:   rendering, the user agent is to allow the user to see while editing
1.151     mike      689:   the element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a>.</p>
                    690: 
                    691:   <p>The <code title="attr-input-size"><a href="#attr-input-size">size</a></code> attribute, if
1.1       mike      692:   specified, must have a value that is a <a href="common-microsyntaxes.html#valid-non-negative-integer">valid non-negative
1.151     mike      693:   integer</a> greater than zero.</p>
                    694: 
                    695:   <div class="impl">
1.1       mike      696: 
                    697:   <p>If the attribute is present, then its value must be parsed using
                    698:   the <a href="common-microsyntaxes.html#rules-for-parsing-non-negative-integers">rules for parsing non-negative integers</a>, and if the
                    699:   result is a number greater than zero, then the user agent should
                    700:   ensure that at least that many characters are visible.</p>
                    701: 
                    702:   <p>The <code title="dom-input-size"><a href="the-input-element.html#dom-input-size">size</a></code> IDL attribute is
                    703:   <a href="common-dom-interfaces.html#limited-to-only-non-negative-numbers-greater-than-zero">limited to only non-negative numbers greater than
1.17      mike      704:   zero</a> and has a default value of 20.</p>
1.1       mike      705: 
1.151     mike      706:   </div>
                    707: 
                    708: 
                    709: 
                    710:   <h6 id="the-required-attribute"><span class="secno">4.10.7.3.6 </span>The <code title="attr-input-required"><a href="#attr-input-required">required</a></code> attribute</h6>
                    711: 
                    712:   <p>The <dfn id="attr-input-required" title="attr-input-required"><code>required</code></dfn>
1.1       mike      713:   attribute is a <a href="common-microsyntaxes.html#boolean-attribute">boolean attribute</a>. When specified, the
1.151     mike      714:   element is <dfn id="concept-input-required" title="concept-input-required"><i>required</i></dfn>.</p>
                    715: 
                    716:   <div class="impl">
1.1       mike      717: 
1.67      mike      718:   <p><strong>Constraint validation</strong>: If the element is <i title="concept-input-required"><a href="#concept-input-required">required</a></i>, and its <code title="dom-input-value"><a href="common-input-element-apis.html#dom-input-value">value</a></code> IDL attribute applies and is in
                    719:   the mode <a href="common-input-element-apis.html#dom-input-value-value" title="dom-input-value-value">value</a>, and the
1.1       mike      720:   element is <i title="concept-input-mutable"><a href="the-input-element.html#concept-input-mutable">mutable</a></i>, and the
1.67      mike      721:   element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a> is the empty
                    722:   string, then the element is <a href="constraints.html#suffering-from-being-missing">suffering from being
1.1       mike      723:   missing</a>.</p>
                    724: 
1.151     mike      725:   </div>
                    726: 
                    727:   <div class="example">
1.1       mike      728: 
                    729:    <p>The following form has two required fields, one for an e-mail
                    730:    address and one for a password. It also has a third field that is
1.119     mike      731:    only considered valid if the user types the same password in the
1.1       mike      732:    password field and this third field.</p>
                    733: 
                    734:    <pre>&lt;h1&gt;Create new account&lt;/h1&gt;
1.33      mike      735: &lt;form action="/newaccount" method=post
                    736:       oninput="up2.setCustomValidity(up2.value != up.value ? 'Passwords do not match.' : '')"&gt;
1.1       mike      737:  &lt;p&gt;
                    738:   &lt;label for="username"&gt;E-mail address:&lt;/label&gt;
                    739:   &lt;input id="username" type=email required name=un&gt;
                    740:  &lt;p&gt;
                    741:   &lt;label for="password1"&gt;Password:&lt;/label&gt;
                    742:   &lt;input id="password1" type=password required name=up&gt;
                    743:  &lt;p&gt;
                    744:   &lt;label for="password2"&gt;Confirm password:&lt;/label&gt;
1.33      mike      745:   &lt;input id="password2" type=password name=up2&gt;
1.1       mike      746:  &lt;p&gt;
                    747:   &lt;input type=submit value="Create account"&gt;
                    748: &lt;/form&gt;</pre>
                    749: 
1.151     mike      750:   </div>
                    751: 
                    752: 
                    753:   <h6 id="the-multiple-attribute"><span class="secno">4.10.7.3.7 </span>The <code title="attr-input-multiple"><a href="#attr-input-multiple">multiple</a></code> attribute</h6>
                    754: 
                    755:   <p>The <dfn id="attr-input-multiple" title="attr-input-multiple"><code>multiple</code></dfn>
1.1       mike      756:   attribute is a <a href="common-microsyntaxes.html#boolean-attribute">boolean attribute</a> that indicates whether
1.151     mike      757:   the user is to be allowed to specify more than one value.</p>
                    758: 
                    759:   <div class="example">
1.1       mike      760: 
                    761:    <p>The following extract shows how an e-mail client's "Cc" field
                    762:    could accept multiple e-mail addresses.</p>
                    763: 
                    764:    <pre>&lt;label&gt;Cc: &lt;input type=email multiple name=cc&gt;&lt;/label&gt;</pre>
                    765: 
                    766:    <p>If the user had, amongst many friends in his user contacts
                    767:    database, two friends "Arthur Dent" (with address
                    768:    "art@example.net") and "Adam Josh" (with address
                    769:    "adamjosh@example.net"), then, after the user has typed "a", the
                    770:    user agent might suggest these two e-mail addresses to the
                    771:    user.</p>
                    772: 
1.225     sruby     773:    <p><img alt="" height="140" src="images/sample-email-1.png" width="500"></p>
1.1       mike      774: 
                    775:    <p>The page could also link in the user's contacts database from the site:</p>
                    776: 
                    777:    <pre>&lt;label&gt;Cc: &lt;input type=email multiple name=cc list=contacts&gt;&lt;/label&gt;
                    778: ...
                    779: &lt;datalist id="contacts"&gt;
                    780:  &lt;option value="hedral@damowmow.com"&gt;
                    781:  &lt;option value="pillar@example.com"&gt;
                    782:  &lt;option value="astrophy@cute.example"&gt;
                    783:  &lt;option value="astronomy@science.example.org"&gt;
                    784: &lt;/datalist&gt;</pre>
                    785: 
                    786:    <p>Suppose the user had entered "bob@example.net" into this text
                    787:    field, and then started typing a second e-mail address starting
                    788:    with "a". The user agent might show both the two friends mentioned
                    789:    earlier, as well as the "astrophy" and "astronomy" values given in
1.67      mike      790:    the <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code> element.</p>
1.1       mike      791: 
1.225     sruby     792:    <p><img alt="" height="171" src="images/sample-email-2.png" width="500"></p>
1.1       mike      793: 
1.151     mike      794:   </div>
                    795: 
                    796:   <div class="example">
1.1       mike      797: 
                    798:    <p>The following extract shows how an e-mail client's "Attachments"
                    799:    field could accept multiple files for upload.</p>
                    800: 
                    801:    <pre>&lt;label&gt;Attachments: &lt;input type=file multiple name=att&gt;&lt;/label&gt;</pre>
                    802: 
1.151     mike      803:   </div>
                    804: 
                    805: 
                    806:   <h6 id="the-maxlength-attribute"><span class="secno">4.10.7.3.8 </span>The <code title="attr-input-maxlength"><a href="#attr-input-maxlength">maxlength</a></code> attribute</h6>
                    807: 
                    808:   <p>The <dfn id="attr-input-maxlength" title="attr-input-maxlength"><code>maxlength</code></dfn>
1.67      mike      809:   attribute<span class="impl">, when it applies,</span> is a <a href="attributes-common-to-form-controls.html#attr-fe-maxlength" title="attr-fe-maxlength">form control <code title="">maxlength</code> attribute</a><span class="impl">
1.1       mike      810:   controlled by the <code><a href="the-input-element.html#the-input-element">input</a></code> element's <a href="the-input-element.html#concept-input-value-dirty-flag" title="concept-input-value-dirty-flag">dirty value
1.151     mike      811:   flag</a></span>.</p>
                    812: 
                    813:   <p>If the <code><a href="the-input-element.html#the-input-element">input</a></code> element has a <a href="attributes-common-to-form-controls.html#maximum-allowed-value-length">maximum allowed
1.191     mike      814:   value length</a>, then the <a href="infrastructure.html#code-unit-length">code-unit length</a> of the
1.1       mike      815:   value of the element's <code title="attr-input-value"><a href="the-input-element.html#attr-input-value">value</a></code>
1.67      mike      816:   attribute must be equal to or less than the element's <a href="attributes-common-to-form-controls.html#maximum-allowed-value-length">maximum
1.151     mike      817:   allowed value length</a>.</p>
                    818: 
                    819:   <div class="example">
1.1       mike      820: 
                    821:    <p>The following extract shows how a messaging client's text entry
                    822:    could be arbitrarily restricted to a fixed number of characters,
1.15      mike      823:    thus forcing any conversation through this medium to be terse and
1.1       mike      824:    discouraging intelligent discourse.</p>
                    825: 
1.59      mike      826:    <pre>&lt;label&gt;What are you doing? &lt;input name=status maxlength=140&gt;&lt;/label&gt;</pre>
1.1       mike      827: 
1.151     mike      828:   </div>
                    829: 
                    830: 
                    831: 
                    832:   <h6 id="the-pattern-attribute"><span class="secno">4.10.7.3.9 </span>The <code title="attr-input-pattern"><a href="#attr-input-pattern">pattern</a></code> attribute</h6>
                    833: 
                    834:   <p>The <dfn id="attr-input-pattern" title="attr-input-pattern"><code>pattern</code></dfn>
1.1       mike      835:   attribute specifies a regular expression against which the control's
1.67      mike      836:   <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a>, or, when the <code title="attr-input-multiple"><a href="#attr-input-multiple">multiple</a></code> attribute applies and is
                    837:   set, the control's <a href="attributes-common-to-form-controls.html#concept-fe-values" title="concept-fe-values">value<em>s</em></a>, are to be
1.151     mike      838:   checked.</p>
                    839: 
                    840:   <p>If specified, the attribute's value must match the JavaScript <i title="">Pattern</i> production. <a href="references.html#refsECMA262">[ECMA262]</a></p>
                    841: 
                    842:   <div class="impl">
1.30      mike      843: 
                    844:   <p>If an <code><a href="the-input-element.html#the-input-element">input</a></code> element has a <code title="attr-input-pattern"><a href="#attr-input-pattern">pattern</a></code> attribute specified, and
                    845:   the attribute's value, when compiled as a JavaScript regular
                    846:   expression with the <code title="">global</code>, <code title="">ignoreCase</code>, and <code title="">multiline</code>
                    847:   flags <em>disabled</em> (see ECMA262 Edition 5, sections 15.10.7.2
                    848:   through 15.10.7.4), compiles successfully, then the resulting
                    849:   regular expression is the element's <dfn id="compiled-pattern-regular-expression">compiled pattern regular
                    850:   expression</dfn>. If the element has no such attribute, or if the
                    851:   value doesn't compile successfully, then the element has no
1.58      mike      852:   <a href="#compiled-pattern-regular-expression">compiled pattern regular expression</a>. <a href="references.html#refsECMA262">[ECMA262]</a></p>
1.1       mike      853: 
1.67      mike      854:   <p><strong>Constraint validation</strong>: If the element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a> is not the empty string, and
1.30      mike      855:   either the element's <code title="attr-input-multiple"><a href="#attr-input-multiple">multiple</a></code> attribute is not
                    856:   specified or it does not apply to the <code><a href="the-input-element.html#the-input-element">input</a></code> element
                    857:   given its <code title="attr-input-type"><a href="the-input-element.html#attr-input-type">type</a></code> attribute's
                    858:   current state, and the element has a <a href="#compiled-pattern-regular-expression">compiled pattern regular
                    859:   expression</a> but that regular expression does not match the
1.67      mike      860:   entirety of the element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a>, then the element is
                    861:   <a href="constraints.html#suffering-from-a-pattern-mismatch">suffering from a pattern mismatch</a>.</p>
1.30      mike      862: 
1.67      mike      863:   <p><strong>Constraint validation</strong>: If the element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a> is not the empty string, and
1.30      mike      864:   the element's <code title="attr-input-multiple"><a href="#attr-input-multiple">multiple</a></code>
                    865:   attribute is specified and applies to the <code><a href="the-input-element.html#the-input-element">input</a></code>
                    866:   element, and the element has a <a href="#compiled-pattern-regular-expression">compiled pattern regular
                    867:   expression</a> but that regular expression does not match the
1.67      mike      868:   entirety of each of the element's <a href="attributes-common-to-form-controls.html#concept-fe-values" title="concept-fe-values">value<em>s</em></a>, then the element
                    869:   is <a href="constraints.html#suffering-from-a-pattern-mismatch">suffering from a pattern mismatch</a>.</p>
1.1       mike      870: 
1.50      mike      871:   <p>The <a href="#compiled-pattern-regular-expression">compiled pattern regular expression</a>, when
                    872:   matched against a string, must have its start anchored to the start
                    873:   of the string and its end anchored to the end of the string.</p>
                    874: 
1.1       mike      875:   <p class="note">This implies that the regular expression language
                    876:   used for this attribute is the same as that used in JavaScript,
                    877:   except that the <code title="attr-input-pattern"><a href="#attr-input-pattern">pattern</a></code>
1.50      mike      878:   attribute is matched against the entire value, not just any subset
                    879:   (somewhat as if it implied a <code title="">^(?:</code> at the start
                    880:   of the pattern and a <code title="">)$</code> at the end).</p>
1.1       mike      881: 
1.151     mike      882:   </div>
                    883: 
                    884:   <p>When an <code><a href="the-input-element.html#the-input-element">input</a></code> element has a <code title="attr-input-pattern"><a href="#attr-input-pattern">pattern</a></code> attribute specified,
1.67      mike      885:   authors should include a <code title="attr-title"><a href="global-attributes.html#the-title-attribute">title</a></code>
1.1       mike      886:   attribute to give a description of the pattern. User agents may use
                    887:   the contents of this attribute, if it is present, when informing the
                    888:   user that the pattern is not matched, or at any other suitable time,
                    889:   such as in a tooltip or read out by assistive technology when the
1.151     mike      890:   control gains focus.</p>
                    891: 
                    892:   <div class="example">
1.1       mike      893:    <p>For example, the following snippet:</p>
                    894:    <pre>&lt;label&gt; Part number:
                    895:  &lt;input pattern="[0-9][A-Z]{3}" name="part"
                    896:         title="A part number is a digit followed by three uppercase letters."/&gt;
                    897: &lt;/label&gt;</pre>
                    898:    <p>...could cause the UA to display an alert such as:</p>
                    899:    <pre><samp>A part number is a digit followed by three uppercase letters.
1.11      mike      900: You cannot submit this form when the field is incorrect.</samp></pre>
1.151     mike      901:   </div>
                    902: 
                    903:   <p>When a control has a <code title="attr-input-pattern"><a href="#attr-input-pattern">pattern</a></code> attribute, the <code title="attr-title"><a href="global-attributes.html#the-title-attribute">title</a></code> attribute, if used, must describe
1.1       mike      904:   the pattern.  Additional information could also be included, so long
                    905:   as it assists the user in filling in the control. Otherwise,
1.151     mike      906:   assistive technology would be impaired.</p>
                    907: 
                    908:   <p class="example">For instance, if the title attribute contained
1.1       mike      909:   the caption of the control, assistive technology could end up saying
                    910:   something like <samp>The text you have entered does not match the
1.151     mike      911:   required pattern. Birthday</samp>, which is not useful.</p>
                    912: 
                    913:   <p>UAs may still show the <code title="attr-title"><a href="global-attributes.html#the-title-attribute">title</a></code> in
1.101     mike      914:   non-error situations (for example, as a tooltip when hovering over
                    915:   the control), so authors should be careful not to word <code title="attr-title"><a href="global-attributes.html#the-title-attribute">title</a></code>s as if an error has necessarily
1.151     mike      916:   occurred.</p>
                    917: 
                    918: 
                    919: 
                    920:   <h6 id="the-min-and-max-attributes"><span class="secno">4.10.7.3.10 </span>The <code title="attr-input-min"><a href="#attr-input-min">min</a></code> and <code title="attr-input-max"><a href="#attr-input-max">max</a></code> attributes</h6>
                    921: 
                    922:   <p>The <dfn id="attr-input-min" title="attr-input-min"><code>min</code></dfn> and <dfn id="attr-input-max" title="attr-input-max"><code>max</code></dfn> attributes indicate
                    923:   the allowed range of values for the element.</p>
                    924: 
                    925:   <div class="impl">
1.1       mike      926: 
                    927:   <p>Their syntax is defined by the section that defines the <code title="attr-input-type"><a href="the-input-element.html#attr-input-type">type</a></code> attribute's current state.</p>
                    928: 
                    929:   <p>If the element has a <code title="attr-input-min"><a href="#attr-input-min">min</a></code>
                    930:   attribute, and the result of applying the <a href="the-input-element.html#concept-input-value-string-number" title="concept-input-value-string-number">algorithm to convert a
                    931:   string to a number</a> to the value of the <code title="attr-input-min"><a href="#attr-input-min">min</a></code> attribute is a number, then that
                    932:   number is the element's <dfn id="concept-input-min" title="concept-input-min">minimum</dfn>; otherwise, if the <code title="attr-input-type"><a href="the-input-element.html#attr-input-type">type</a></code> attribute's current state
                    933:   defines a <dfn id="concept-input-min-default" title="concept-input-min-default">default
                    934:   minimum</dfn>, then that is the <a href="#concept-input-min" title="concept-input-min">minimum</a>; otherwise, the element has
                    935:   no <a href="#concept-input-min" title="concept-input-min">minimum</a>.</p>
                    936: 
                    937:   <p><strong>Constraint validation</strong>: When the element has a
                    938:   <a href="#attr-input-min" title="attr-input-min">minimum</a>, and the result of
                    939:   applying the <a href="the-input-element.html#concept-input-value-string-number" title="concept-input-value-string-number">algorithm to convert a
1.67      mike      940:   string to a number</a> to the string given by the element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a> is a number, and the number
1.1       mike      941:   obtained from that algorithm is less than the <a href="#attr-input-min" title="attr-input-min">minimum</a>, the element is
1.67      mike      942:   <a href="constraints.html#suffering-from-an-underflow">suffering from an underflow</a>.</p>
1.1       mike      943: 
                    944:   <p>The <code title="attr-input-min"><a href="#attr-input-min">min</a></code> attribute also
                    945:   defines the <a href="#concept-input-min-zero" title="concept-input-min-zero">step
                    946:   base</a>.</p>
                    947: 
                    948:   <p>If the element has a <code title="attr-input-max"><a href="#attr-input-max">max</a></code>
                    949:   attribute, and the result of applying the <a href="the-input-element.html#concept-input-value-string-number" title="concept-input-value-string-number">algorithm to convert a
                    950:   string to a number</a> to the value of the <code title="attr-input-max"><a href="#attr-input-max">max</a></code> attribute is a number, then that
                    951:   number is the element's <dfn id="concept-input-max" title="concept-input-max">maximum</dfn>; otherwise, if the <code title="attr-input-type"><a href="the-input-element.html#attr-input-type">type</a></code> attribute's current state
                    952:   defines a <dfn id="concept-input-max-default" title="concept-input-max-default">default
                    953:   maximum</dfn>, then that is the <a href="#concept-input-max" title="concept-input-max">maximum</a>; otherwise, the element has
                    954:   no <a href="#concept-input-max" title="concept-input-max">maximum</a>.</p>
                    955: 
                    956:   <p><strong>Constraint validation</strong>: When the element has a
                    957:   <a href="#attr-input-max" title="attr-input-max">maximum</a>, and the result of
                    958:   applying the <a href="the-input-element.html#concept-input-value-string-number" title="concept-input-value-string-number">algorithm to convert a
1.67      mike      959:   string to a number</a> to the string given by the element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a> is a number, and the number
1.1       mike      960:   obtained from that algorithm is more than the <a href="#attr-input-max" title="attr-input-max">maximum</a>, the element is
1.67      mike      961:   <a href="constraints.html#suffering-from-an-overflow">suffering from an overflow</a>.</p>
1.1       mike      962: 
1.151     mike      963:   </div>
                    964: 
                    965:   <p>The <code title="attr-input-max"><a href="#attr-input-max">max</a></code> attribute's value
1.1       mike      966:   (the <a href="#concept-input-max" title="concept-input-max">maximum</a>) must not be
                    967:   less than the <code title="attr-input-min"><a href="#attr-input-min">min</a></code> attribute's
1.151     mike      968:   value (its <a href="#concept-input-min" title="concept-input-min">minimum</a>).</p>
                    969: 
                    970:   <div class="impl">
1.1       mike      971: 
                    972:   <p class="note">If an element has a <a href="#attr-input-max" title="attr-input-max">maximum</a> that is less than its <a href="#attr-input-min" title="attr-input-min">minimum</a>, then so long as the element
1.67      mike      973:   has a <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a>, it will either be
                    974:   <a href="constraints.html#suffering-from-an-underflow">suffering from an underflow</a> or <a href="constraints.html#suffering-from-an-overflow">suffering from an
1.1       mike      975:   overflow</a>.</p>
                    976: 
1.151     mike      977:   </div>
                    978: 
                    979:   <p>An element <dfn id="have-range-limitations" title="have range limitations">has range
                    980:   limitations</dfn> if it has a defined <a href="#concept-input-min" title="concept-input-min">minimum</a> or a defined <a href="#concept-input-max" title="concept-input-max">maximum</a>.</p>
                    981: 
                    982:   <div class="example">
1.1       mike      983: 
                    984:    <p>The following date control limits input to dates that are before
                    985:    the 1980s:</p>
                    986: 
                    987:    <pre>&lt;input name=bday type=date max="1979-12-31"&gt;</pre>
                    988: 
1.151     mike      989:   </div>
                    990: 
                    991:   <div class="example">
1.1       mike      992: 
                    993:    <p>The following number control limits input to whole numbers
                    994:    greater than zero:</p>
                    995: 
                    996:    <pre>&lt;input name=quantity required type=number min=1 value=1&gt;</pre>
                    997: 
1.151     mike      998:   </div>
                    999: 
                   1000: 
                   1001:   <h6 id="the-step-attribute"><span class="secno">4.10.7.3.11 </span>The <code title="attr-input-step"><a href="#attr-input-step">step</a></code> attribute</h6>
                   1002: 
                   1003:   <p>The <dfn id="attr-input-step" title="attr-input-step"><code>step</code></dfn>
1.1       mike     1004:   attribute indicates the granularity that is expected (and required)
1.67      mike     1005:   of the <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a>, by limiting the
1.1       mike     1006:   allowed values. <span class="impl">The section that defines the
                   1007:   <code title="attr-input-type"><a href="the-input-element.html#attr-input-type">type</a></code> attribute's current state
                   1008:   also defines the <dfn id="concept-input-step-default" title="concept-input-step-default">default
                   1009:   step</dfn>, the <dfn id="concept-input-step-scale" title="concept-input-step-scale">step scale
                   1010:   factor</dfn>, and in some cases the <dfn id="concept-input-step-default-base" title="concept-input-step-default-base">default step base</dfn>,
                   1011:   which are used in processing the attribute as described
1.151     mike     1012:   below.</span></p>
                   1013: 
                   1014:   <p>The <code title="attr-input-step"><a href="#attr-input-step">step</a></code> attribute, if
1.228     sruby    1015:   specified, must either have a value that is a <a href="common-microsyntaxes.html#valid-floating-point-number">valid
                   1016:   floating-point number</a> that <a href="common-microsyntaxes.html#rules-for-parsing-floating-point-number-values" title="rules for parsing
                   1017:   floating-point number values">parses</a> to a number that is
                   1018:   greater than zero, or must have a value that is an <a href="infrastructure.html#ascii-case-insensitive">ASCII
1.151     mike     1019:   case-insensitive</a> match for the string "<code title="">any</code>".</p>
                   1020: 
                   1021:   <div class="impl">
1.1       mike     1022: 
                   1023:   <p>The attribute provides the <dfn id="concept-input-step" title="concept-input-step">allowed value step</dfn> for the element,
                   1024:   as follows:</p>
                   1025: 
                   1026:   <ol><li>If the attribute is absent, then the <a href="#concept-input-step" title="concept-input-step">allowed value step</a> is the <a href="#concept-input-step-default" title="concept-input-step-default">default step</a> multiplied
                   1027:    by the <a href="#concept-input-step-scale" title="concept-input-step-scale">step scale
                   1028:    factor</a>.</li>
                   1029: 
                   1030:    <li>Otherwise, if the attribute's value is an <a href="infrastructure.html#ascii-case-insensitive">ASCII
                   1031:    case-insensitive</a> match for the string "<code title="">any</code>", then there is no <a href="#concept-input-step" title="concept-input-step">allowed value step</a>.</li>
                   1032: 
1.228     sruby    1033:    <li>Otherwise, if the <a href="common-microsyntaxes.html#rules-for-parsing-floating-point-number-values">rules for parsing floating-point number
1.1       mike     1034:    values</a>, when they are applied to the attribute's value,
                   1035:    return an error, zero, or a number less than zero, then the <a href="#concept-input-step" title="concept-input-step">allowed value step</a> is the <a href="#concept-input-step-default" title="concept-input-step-default">default step</a> multiplied
                   1036:    by the <a href="#concept-input-step-scale" title="concept-input-step-scale">step scale
                   1037:    factor</a>.</li>
                   1038: 
                   1039:    <li>Otherwise, the <a href="#concept-input-step" title="concept-input-step">allowed value
                   1040:    step</a> is the number returned by the <a href="common-microsyntaxes.html#rules-for-parsing-floating-point-number-values">rules for parsing
1.228     sruby    1041:    floating-point number values</a> when they are applied to the
1.1       mike     1042:    attribute's value, multiplied by the <a href="#concept-input-step-scale" title="concept-input-step-scale">step scale factor</a>.</li>
                   1043: 
                   1044:   </ol><p>The <dfn id="concept-input-min-zero" title="concept-input-min-zero">step base</dfn> is the
                   1045:   result of applying the <a href="the-input-element.html#concept-input-value-string-number" title="concept-input-value-string-number">algorithm to convert a
                   1046:   string to a number</a> to the value of the <code title="attr-input-min"><a href="#attr-input-min">min</a></code> attribute, unless the element does
                   1047:   not have a <code title="attr-input-min"><a href="#attr-input-min">min</a></code> attribute
                   1048:   specified or the result of applying that algorithm is an error, in
                   1049:   which case the <a href="#concept-input-min-zero" title="concept-input-min-zero">step base</a>
                   1050:   is the <a href="#concept-input-step-default-base" title="concept-input-step-default-base">default step
                   1051:   base</a>, if one is defined, or zero, if not.</p>
                   1052: 
                   1053:   <p><strong>Constraint validation</strong>: When the element has an
                   1054:   <a href="#concept-input-step" title="concept-input-step">allowed value step</a>, and the
                   1055:   result of applying the <a href="the-input-element.html#concept-input-value-string-number" title="concept-input-value-string-number">algorithm to convert a
1.67      mike     1056:   string to a number</a> to the string given by the element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a> is a number, and that
1.1       mike     1057:   number subtracted from the <a href="#concept-input-min-zero" title="concept-input-min-zero">step
                   1058:   base</a> is not an integral multiple of the <a href="#concept-input-step" title="concept-input-step">allowed value step</a>, the element is
1.67      mike     1059:   <a href="constraints.html#suffering-from-a-step-mismatch">suffering from a step mismatch</a>.</p>
1.1       mike     1060: 
1.151     mike     1061:   </div>
                   1062: 
                   1063:   <div class="example">
1.1       mike     1064: 
                   1065:    <p>The following range control only accepts values in the range
                   1066:    0..1, and allows 256 steps in that range:</p>
                   1067: 
                   1068:    <pre>&lt;input name=opacity type=range min=0 max=1 step=0.00392156863&gt;</pre>
                   1069: 
1.151     mike     1070:   </div>
                   1071: 
                   1072:   <div class="example">
1.1       mike     1073: 
                   1074:    <p>The following control allows any time in the day to be selected,
                   1075:    with any accuracy (e.g. thousandth-of-a-second accuracy or
                   1076:    more):</p>
                   1077: 
                   1078:    <pre>&lt;input name=favtime type=time step=any&gt;</pre>
                   1079: 
                   1080:    <p>Normally, time controls are limited to an accuracy of one
                   1081:    minute.</p>
                   1082: 
1.151     mike     1083:   </div>
                   1084: 
                   1085: 
                   1086: 
                   1087: 
                   1088:   <h6 id="the-placeholder-attribute"><span class="secno">4.10.7.3.12 </span>The <code title="attr-input-placeholder"><a href="#attr-input-placeholder">placeholder</a></code> attribute</h6>
                   1089: 
1.225     sruby    1090:   <!-- similar text in the <textarea> section -->
1.151     mike     1091: 
                   1092:   <p>The <dfn id="attr-input-placeholder" title="attr-input-placeholder"><code>placeholder</code></dfn>
1.1       mike     1093:   attribute represents a <em>short</em> hint (a word or short phrase)
                   1094:   intended to aid the user with data entry. A hint could be a sample
                   1095:   value or a brief description of the expected format. The attribute,
1.151     mike     1096:   if specified, must have a value that contains no "LF" (U+000A) or "CR" (U+000D) characters.</p>
                   1097: 
                   1098:   <p class="note">For a longer hint or other advisory text, the <code title="attr-title"><a href="global-attributes.html#the-title-attribute">title</a></code> attribute is more appropriate.</p>
                   1099: 
                   1100:   <p>The <code title="attr-input-placeholder"><a href="#attr-input-placeholder">placeholder</a></code>
1.1       mike     1101:   attribute should not be used as an alternative to a
1.151     mike     1102:   <code><a href="the-label-element.html#the-label-element">label</a></code>.</p>
                   1103: 
                   1104:   <div class="impl">
1.1       mike     1105: 
                   1106:   <p>User agents should present this hint to the user, after having
                   1107:   <a href="common-microsyntaxes.html#strip-line-breaks" title="strip line breaks">stripped line breaks</a> from it,
1.67      mike     1108:   when the element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a> is
1.66      mike     1109:   the empty string and/or the control is not focused (e.g. by
                   1110:   displaying it inside a blank unfocused control and hiding it
                   1111:   otherwise).</p>
1.1       mike     1112: 
1.151     mike     1113:   </div>
                   1114: 
                   1115:   <div class="example">
1.1       mike     1116: 
                   1117:    <p>Here is an example of a mail configuration user interface that
                   1118:    uses the <code title="attr-input-placeholder"><a href="#attr-input-placeholder">placeholder</a></code>
                   1119:    attribute:</p>
                   1120: 
                   1121:    <pre>&lt;fieldset&gt;
                   1122:  &lt;legend&gt;Mail Account&lt;/legend&gt;
                   1123:  &lt;p&gt;&lt;label&gt;Name: &lt;input type="text" name="fullname" placeholder="John Ratzenberger"&gt;&lt;/label&gt;&lt;/p&gt;
                   1124:  &lt;p&gt;&lt;label&gt;Address: &lt;input type="email" name="address" placeholder="john@example.net"&gt;&lt;/label&gt;&lt;/p&gt;
                   1125:  &lt;p&gt;&lt;label&gt;Password: &lt;input type="password" name="password"&gt;&lt;/label&gt;&lt;/p&gt;
                   1126:  &lt;p&gt;&lt;label&gt;Description: &lt;input type="text" name="desc" placeholder="My Email Account"&gt;&lt;/label&gt;&lt;/p&gt;
                   1127: &lt;/fieldset&gt;</pre>
                   1128: 
1.151     mike     1129:   </div>
                   1130: 
                   1131: 
                   1132: 
1.225     sruby    1133: <!--TOPIC:DOM APIs-->
1.151     mike     1134:   </body></html>

Webmaster