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

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';
1.239     sruby     282:      src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743.ttf');
1.4       mike      283:    }
                    284:    @font-face {
                    285:      font-family: 'Essays1743';
                    286:      font-weight: bold;
1.239     sruby     287:      src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Bold.ttf');
1.4       mike      288:    }
                    289:    @font-face {
                    290:      font-family: 'Essays1743';
                    291:      font-style: italic;
1.239     sruby     292:      src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Italic.ttf');
1.4       mike      293:    }
                    294:    @font-face {
                    295:      font-family: 'Essays1743';
                    296:      font-style: italic;
                    297:      font-weight: bold;
1.239     sruby     298:      src: url('http://www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-BoldItalic.ttf');
1.4       mike      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.239     sruby     327:    <h2 class="no-num no-toc" id="editor's-draft-date-1-january-1970">Editor's Draft 12 September 2012</h2>
1.151     mike      328:    </div>
1.240     sruby     329:    <div class="prev_next">
1.74      mike      330:    <a href="states-of-the-type-attribute.html">&#8592; 4.10.7.1 States of the type attribute</a> &#8211;
1.227     sruby     331:    <a href="spec.html#contents">Table of contents</a> &#8211;
1.99      mike      332:    <a href="common-input-element-apis.html">4.10.7.4 Common input element APIs &#8594;</a>
                    333:   <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     334:         <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      335: 
1.151     mike      336:   <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>
                    337: 
                    338:   <div class="impl">
1.1       mike      339: 
                    340:   <p>These attributes only apply to an <code><a href="the-input-element.html#the-input-element">input</a></code> element if
                    341:   its <code title="attr-input-type"><a href="the-input-element.html#attr-input-type">type</a></code> attribute is in a
                    342:   state whose definition declares that the attribute applies. When an
1.85      mike      343:   attribute <dfn id="do-not-apply" title="do not apply">doesn't apply</dfn> to an
                    344:   <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
                    345:   attribute, regardless of the requirements and definitions
                    346:   below.</p>
1.1       mike      347: 
1.151     mike      348:   </div>
                    349: 
                    350: 
                    351:   <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>
                    352: 
                    353:   <p>User agents sometimes have features for helping users fill forms
1.1       mike      354:   in, for example prefilling the user's address based on earlier user
1.151     mike      355:   input.</p>
                    356: 
                    357:   <p>The <dfn id="attr-input-autocomplete" title="attr-input-autocomplete"><code>autocomplete</code></dfn>
1.1       mike      358:   attribute is an <a href="common-microsyntaxes.html#enumerated-attribute">enumerated attribute</a>. The attribute has
                    359:   three states. The <code title="attr-input-autocomplete-on">on</code>
                    360:   keyword maps to the <dfn id="attr-input-autocomplete-on-state" title="attr-input-autocomplete-on-state">on</dfn> state, and the
                    361:   <code title="attr-input-autocomplete-off">off</code> keyword maps to
                    362:   the <dfn id="attr-input-autocomplete-off-state" title="attr-input-autocomplete-off-state">off</dfn>
                    363:   state. The attribute may also be omitted. The <i>missing value
                    364:   default</i> is the <dfn id="attr-input-autocomplete-default-state" title="attr-input-autocomplete-default-state">default</dfn>
1.151     mike      365:   state.</p>
                    366: 
                    367:   <p>The <a href="#attr-input-autocomplete-off-state" title="attr-input-autocomplete-off-state">off</a>
1.1       mike      368:   state indicates either that the control's input data is particularly
                    369:   sensitive (for example the activation code for a nuclear weapon); or
                    370:   that it is a value that will never be reused (for example a
                    371:   one-time-key for a bank login) and the user will therefore have to
                    372:   explicitly enter the data each time, instead of being able to rely
                    373:   on the UA to prefill the value for him; or that the document
                    374:   provides its own autocomplete mechanism and does not want the user
1.151     mike      375:   agent to provide autocompletion values.</p>
                    376: 
                    377:   <p>Conversely, the <a href="#attr-input-autocomplete-on-state" title="attr-input-autocomplete-on-state">on</a> state indicates
1.1       mike      378:   that the value is not particularly sensitive and the user can expect
                    379:   to be able to rely on his user agent to remember values he has
1.151     mike      380:   entered for that control.</p>
                    381: 
                    382:   <p>The <a href="#attr-input-autocomplete-default-state" title="attr-input-autocomplete-default-state">default</a> state
1.67      mike      383:   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
                    384:   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      385:   <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>
                    386: 
                    387:   <div class="impl">
1.1       mike      388: 
                    389:   <p>Each <code><a href="the-input-element.html#the-input-element">input</a></code> element has a <dfn id="resulting-autocompletion-state">resulting
                    390:   autocompletion state</dfn>, which is either <i title="">on</i> or <i title="">off</i>.</p>
                    391: 
                    392:   <p>When an <code><a href="the-input-element.html#the-input-element">input</a></code> element is in one of the following
                    393:   conditions, the <code><a href="the-input-element.html#the-input-element">input</a></code> element's <a href="#resulting-autocompletion-state">resulting
                    394:   autocompletion state</a> is <i title="">on</i>; otherwise, the
                    395:   <code><a href="the-input-element.html#the-input-element">input</a></code> element's <a href="#resulting-autocompletion-state">resulting autocompletion
                    396:   state</a> is <i title="">off</i>:</p>
                    397: 
                    398:   <ul class="brief"><li>Its <code title="attr-input-autocomplete"><a href="#attr-input-autocomplete">autocomplete</a></code>
                    399:    attribute is in the <a href="#attr-input-autocomplete-on-state" title="attr-input-autocomplete-on-state">on</a> state.</li>
                    400: 
                    401:    <li>Its <code title="attr-input-autocomplete"><a href="#attr-input-autocomplete">autocomplete</a></code>
                    402:    attribute is in the <a href="#attr-input-autocomplete-default-state" title="attr-input-autocomplete-default-state">default</a> state,
                    403:    and the element has no <a href="association-of-controls-and-forms.html#form-owner">form owner</a>.</li>
                    404: 
                    405:    <li>Its <code title="attr-input-autocomplete"><a href="#attr-input-autocomplete">autocomplete</a></code>
                    406:    attribute is in the <a href="#attr-input-autocomplete-default-state" title="attr-input-autocomplete-default-state">default</a> state,
1.67      mike      407:    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
                    408:    the <a href="the-form-element.html#attr-form-autocomplete-on-state" title="attr-form-autocomplete-on-state">on</a>
1.1       mike      409:    state.</li>
                    410: 
                    411:   </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
                    412:   autocompletion state</a> is <i title="">on</i>, the user agent
                    413:   may store the value entered by the user so that if the user returns
                    414:   to the page, the UA can prefill the form. Otherwise, the user agent
1.67      mike      415:   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      416:   values to the user.</p>
                    417: 
                    418:   <p>In addition, if the <a href="#resulting-autocompletion-state">resulting autocompletion state</a>
                    419:   is <i title="">off</i>, <a href="history.html#history-autocomplete">values are
                    420:   reset</a> when <a href="history.html#traverse-the-history" title="traverse the history">traversing the
                    421:   history</a>.</p>
                    422: 
                    423:   <p>The autocompletion mechanism must be implemented by the user
1.67      mike      424:   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      425:   where the element is <i title="concept-input-mutable"><a href="the-input-element.html#concept-input-mutable">mutable</a></i>
                    426:   (e.g. just after the element has been inserted into the document, or
1.58      mike      427:   when the user agent <a href="the-end.html#stop-parsing" title="stop parsing">stops
1.1       mike      428:   parsing</a>).</p>
                    429: 
1.151     mike      430:   </div>
                    431: 
                    432:   <div class="example">
1.1       mike      433: 
                    434:    <p>Banks frequently do not want UAs to prefill login
                    435:    information:</p>
                    436: 
                    437:    <pre>&lt;p&gt;&lt;label&gt;Account: &lt;input type="text" name="ac" autocomplete="off"&gt;&lt;/label&gt;&lt;/p&gt;
                    438: &lt;p&gt;&lt;label&gt;PIN: &lt;input type="password" name="pin" autocomplete="off"&gt;&lt;/label&gt;&lt;/p&gt;</pre>
                    439: 
1.151     mike      440:   </div>
                    441: 
                    442:   <div class="impl">
1.1       mike      443: 
                    444:   <p>A user agent may allow the user to override the <a href="#resulting-autocompletion-state">resulting
                    445:   autocompletion state</a> and set it to always <i title="">on</i>,
1.60      mike      446:   always allowing values to be remembered and prefilled, or always <i title="">off</i>, never remembering values. However, user agents
                    447:   should not allow users to trivially override the <a href="#resulting-autocompletion-state">resulting
                    448:   autocompletion state</a> to <i title="">on</i>, as there are
1.1       mike      449:   significant security implications for the user if all values are
                    450:   always remembered, regardless of the site's preferences.</p>
                    451: 
1.151     mike      452:   </div>
                    453: 
                    454: 
                    455:   <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>
                    456: 
                    457:   <p>The <dfn id="attr-input-dirname" title="attr-input-dirname"><code>dirname</code></dfn>
1.225     sruby     458:   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      459: 
                    460:   <div class="example">
1.25      mike      461: 
                    462:    <p>In this example, a form contains a text field and a submission
                    463:    button:</p>
                    464: 
                    465:    <pre>&lt;form action="addcomment.cgi" method=post&gt;
                    466:  &lt;p&gt;&lt;label&gt;Comment: &lt;input type=text name="comment" dirname="comment.dir" required&gt;&lt;/label&gt;&lt;/p&gt;
                    467:  &lt;p&gt;&lt;button name="mode" type=submit value="add"&gt;Post Comment&lt;/button&gt;&lt;/p&gt;
                    468: &lt;/form&gt;</pre>
                    469: 
                    470:    <p>When the user submits the form, the user agent includes three
                    471:    fields, one called "comment", one called "comment.dir", and one
                    472:    called "mode"; so if the user types "Hello", the submission body
                    473:    might be something like:</p>
                    474: 
                    475:    <pre>comment=Hello&amp;<strong>comment.dir=ltr</strong>&amp;mode=add</pre>
                    476: 
                    477:    <p>If the user manually switches to a right-to-left writing
                    478:    direction and enters "<span dir="rtl" lang="ar" title="">&#1605;&#1585;&#1581;&#1576;&#1611;&#1575;</span>", the
                    479:    submission body might be something like:</p>
                    480: 
                    481:    <pre>comment=%D9%85%D8%B1%D8%AD%D8%A8%D9%8B%D8%A7&amp;<strong>comment.dir=rtl</strong>&amp;mode=add</pre>
                    482: 
1.151     mike      483:   </div>
                    484: 
                    485: 
                    486:   <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>
                    487: 
                    488:   <p>The <dfn id="attr-input-list" title="attr-input-list"><code>list</code></dfn>
1.1       mike      489:   attribute is used to identify an element that lists predefined
1.151     mike      490:   options suggested to the user.</p>
                    491: 
                    492:   <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
                    493:   the same document.</p>
                    494: 
                    495:   <div class="impl">
1.1       mike      496: 
                    497:   <p>The <dfn id="concept-input-list" title="concept-input-list">suggestions source
                    498:   element</dfn> is the first element in the document in <a href="infrastructure.html#tree-order">tree
1.62      mike      499:   order</a> to have an <a href="infrastructure.html#concept-id" title="concept-id">ID</a> equal to
1.30      mike      500:   the value of the <code title="attr-input-list"><a href="#attr-input-list">list</a></code>
1.67      mike      501:   attribute, if that element is a <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code> element. If
1.30      mike      502:   there is no <code title="attr-input-list"><a href="#attr-input-list">list</a></code> attribute, or
1.62      mike      503:   if there is no element with that <a href="infrastructure.html#concept-id" title="concept-id">ID</a>,
                    504:   or if the first element with that <a href="infrastructure.html#concept-id" title="concept-id">ID</a>
1.67      mike      505:   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      506: 
                    507:   <p>If there is a <a href="#concept-input-list" title="concept-input-list">suggestions source
                    508:   element</a>, then, when the user agent is allowing the user to
1.67      mike      509:   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      510:   the suggestions represented by the <a href="#concept-input-list" title="concept-input-list">suggestions source element</a> to the
                    511:   user in a manner suitable for the type of control used. The user
1.67      mike      512:   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      513:   if appropriate.</p>
1.1       mike      514: 
1.30      mike      515:   <p>How user selections of suggestions are handled depends on whether
                    516:   the element is a control accepting a single value only, or whether
                    517:   it accepts multiple values:</p>
                    518: 
                    519:   <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
                    520:    if the <code title="attr-input-multiple"><a href="#attr-input-multiple">multiple</a></code> attribute
                    521:    does not apply</dt>
                    522: 
                    523:    <dd>
                    524: 
                    525:     <p>When the user selects a suggestion, the <code><a href="the-input-element.html#the-input-element">input</a></code>
1.67      mike      526:     element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a> must be set
                    527:     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      528:     written that value himself.</p>
                    529: 
                    530:    </dd>
                    531: 
                    532:    <dt>If the element <em>does</em> have a <code title="attr-input-multiple"><a href="#attr-input-multiple">multiple</a></code> attribute specified,
                    533:    and the <code title="attr-input-multiple"><a href="#attr-input-multiple">multiple</a></code> attribute
                    534:    does apply</dt>
                    535: 
                    536:    <dd>
                    537: 
                    538:     <p>When the user selects a suggestion, the user agent must either
1.67      mike      539:     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
                    540:     the selected suggestion's <a href="the-option-element.html#concept-option-value" title="concept-option-value">value</a>, or change an existing
                    541:     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
                    542:     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      543:     himself added an entry with that value, or edited an existing
                    544:     entry to be that value. Which behavior is to be applied depends on
                    545:     the user interface in a user-agent-defined manner.</p>
                    546: 
                    547:    </dd>
                    548: 
                    549:   </dl><hr><p>If the <code title="attr-input-list"><a href="#attr-input-list">list</a></code> attribute does
1.1       mike      550:   not apply, there is no <a href="#concept-input-list" title="concept-input-list">suggestions
                    551:   source element</a>.</p>
                    552: 
1.151     mike      553:   </div>
                    554: 
                    555:   <div class="example">
1.1       mike      556: 
                    557:    <p>This URL field offers some suggestions.</p>
                    558: 
                    559:    <pre>&lt;label&gt;Homepage: &lt;input name=hp type=url list=hpurls&gt;&lt;/label&gt;
                    560: &lt;datalist id=hpurls&gt;
                    561:  &lt;option value="http://www.google.com/" label="Google"&gt;
                    562:  &lt;option value="http://www.reddit.com/" label="Reddit"&gt;
                    563: &lt;/datalist&gt;</pre>
                    564: 
                    565:    <p>Other URLs from the user's history might show also; this is up
                    566:    to the user agent.</p>
                    567: 
1.151     mike      568:   </div>
                    569: 
                    570:   <div class="example">
1.1       mike      571: 
                    572:    <p>This example demonstrates how to design a form that uses the
                    573:    autocompletion list feature while still degrading usefully in
                    574:    legacy user agents.</p>
                    575: 
                    576:    <p>If the autocompletion list is merely an aid, and is not
1.67      mike      577:    important to the content, then simply using a <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code>
                    578:    element with children <code><a href="the-option-element.html#the-option-element">option</a></code> elements is enough. To
1.1       mike      579:    prevent the values from being rendered in legacy user agents, they
1.67      mike      580:    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      581:    inline.</p>
                    582: 
                    583:    <pre>&lt;p&gt;
                    584:  &lt;label&gt;
                    585:   Enter a breed:
                    586:   &lt;input type="text" name="breed" list="breeds"&gt;
                    587:   &lt;datalist id="breeds"&gt;
                    588:    &lt;option value="Abyssinian"&gt;
                    589:    &lt;option value="Alpaca"&gt;
                    590:    &lt;!-- ... --&gt;
                    591:   &lt;/datalist&gt;
                    592:  &lt;/label&gt;
                    593: &lt;/p&gt;</pre>
                    594: 
                    595:    <p>However, if the values need to be shown in legacy UAs, then
1.67      mike      596:    fallback content can be placed inside the <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code>
1.1       mike      597:    element, as follows:</p>
                    598: 
                    599:    <pre>&lt;p&gt;
                    600:  &lt;label&gt;
                    601:   Enter a breed:
                    602:   &lt;input type="text" name="breed" list="breeds"&gt;
                    603:  &lt;/label&gt;
                    604:  &lt;datalist id="breeds"&gt;
                    605:   &lt;label&gt;
                    606:    or select one from the list:
                    607:    &lt;select name="breed"&gt;
                    608:     &lt;option value=""&gt; (none selected)
                    609:     &lt;option&gt;Abyssinian
                    610:     &lt;option&gt;Alpaca
                    611:     &lt;!-- ... --&gt;
                    612:    &lt;/select&gt;
                    613:   &lt;/label&gt;
                    614:  &lt;/datalist&gt;
                    615: &lt;/p&gt;
                    616: </pre>
                    617: 
                    618:    <p>The fallback content will only be shown in UAs that don't
1.67      mike      619:    support <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code>. The options, on the other hand, will
1.54      mike      620:    be detected by all UAs, even though they are not children of the
1.67      mike      621:    <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code> element.</p>
1.1       mike      622: 
1.67      mike      623:    <p>Note that if an <code><a href="the-option-element.html#the-option-element">option</a></code> element used in a
                    624:    <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      625:    by default by legacy UAs (because it affects the
1.67      mike      626:    <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      627:    <code><a href="the-input-element.html#the-input-element">input</a></code> element in UAs that support
1.67      mike      628:    <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code>.</p>
1.1       mike      629: 
1.151     mike      630:   </div>
                    631: 
                    632: 
                    633: 
                    634:   <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>
                    635: 
                    636:   <p>The <dfn id="attr-input-readonly" title="attr-input-readonly"><code>readonly</code></dfn>
1.1       mike      637:   attribute is a <a href="common-microsyntaxes.html#boolean-attribute">boolean attribute</a> that controls whether
1.12      mike      638:   or not the user can edit the form control. <span class="impl">When
1.151     mike      639:   specified, the element is <i title="concept-input-immutable"><a href="the-input-element.html#concept-input-immutable">immutable</a></i>.</span></p>
                    640: 
                    641:   <div class="impl">
1.1       mike      642: 
                    643:   <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      644:   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      645:   constraint validation</a>.</p>
                    646: 
1.151     mike      647:   </div>
                    648: 
                    649:   <div class="example">
1.1       mike      650: 
                    651:    <p>In the following example, the existing product identifiers
                    652:    cannot be modified, but they are still displayed as part of the
                    653:    form, for consistency with the row representing a new product
                    654:    (where the identifier is not yet filled in).</p>
                    655: 
                    656:    <pre>&lt;form action="products.cgi" method=post enctype="multipart/form-data"&gt;
                    657:  &lt;table&gt;
                    658:   &lt;tr&gt; &lt;th&gt; Product ID &lt;th&gt; Product name &lt;th&gt; Price &lt;th&gt; Action
                    659:   &lt;tr&gt;
                    660:    &lt;td&gt; &lt;input readonly name="1.pid" value="H412"&gt;
                    661:    &lt;td&gt; &lt;input required name="1.pname" value="Floor lamp Ulke"&gt;
                    662:    &lt;td&gt; $&lt;input required type=number min=0 step=0.01 name="1.pprice" value="49.99"&gt;
                    663:    &lt;td&gt; &lt;button formnovalidate name="action" value="delete:1"&gt;Delete&lt;/button&gt;
                    664:   &lt;tr&gt;
                    665:    &lt;td&gt; &lt;input readonly name="2.pid" value="FG28"&gt;
                    666:    &lt;td&gt; &lt;input required name="2.pname" value="Table lamp Ulke"&gt;
                    667:    &lt;td&gt; $&lt;input required type=number min=0 step=0.01 name="2.pprice" value="24.99"&gt;
                    668:    &lt;td&gt; &lt;button formnovalidate name="action" value="delete:2"&gt;Delete&lt;/button&gt;
                    669:   &lt;tr&gt;
                    670:    &lt;td&gt; &lt;input required name="3.pid" value="" pattern="[A-Z0-9]+"&gt;
                    671:    &lt;td&gt; &lt;input required name="3.pname" value=""&gt;
                    672:    &lt;td&gt; $&lt;input required type=number min=0 step=0.01 name="3.pprice" value=""&gt;
                    673:    &lt;td&gt; &lt;button formnovalidate name="action" value="delete:3"&gt;Delete&lt;/button&gt;
                    674:  &lt;/table&gt;
                    675:  &lt;p&gt; &lt;button formnovalidate name="action" value="add"&gt;Add&lt;/button&gt; &lt;/p&gt;
                    676:  &lt;p&gt; &lt;button name="action" value="update"&gt;Save&lt;/button&gt; &lt;/p&gt;
                    677: &lt;/form&gt;</pre>
                    678: 
1.151     mike      679:   </div>
                    680: 
                    681: 
                    682: 
                    683:   <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>
                    684: 
                    685:   <p>The <dfn id="attr-input-size" title="attr-input-size"><code>size</code></dfn>
1.1       mike      686:   attribute gives the number of characters that, in a visual
                    687:   rendering, the user agent is to allow the user to see while editing
1.151     mike      688:   the element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a>.</p>
                    689: 
                    690:   <p>The <code title="attr-input-size"><a href="#attr-input-size">size</a></code> attribute, if
1.1       mike      691:   specified, must have a value that is a <a href="common-microsyntaxes.html#valid-non-negative-integer">valid non-negative
1.151     mike      692:   integer</a> greater than zero.</p>
                    693: 
                    694:   <div class="impl">
1.1       mike      695: 
                    696:   <p>If the attribute is present, then its value must be parsed using
                    697:   the <a href="common-microsyntaxes.html#rules-for-parsing-non-negative-integers">rules for parsing non-negative integers</a>, and if the
                    698:   result is a number greater than zero, then the user agent should
                    699:   ensure that at least that many characters are visible.</p>
                    700: 
                    701:   <p>The <code title="dom-input-size"><a href="the-input-element.html#dom-input-size">size</a></code> IDL attribute is
                    702:   <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      703:   zero</a> and has a default value of 20.</p>
1.1       mike      704: 
1.151     mike      705:   </div>
                    706: 
                    707: 
                    708: 
                    709:   <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>
                    710: 
                    711:   <p>The <dfn id="attr-input-required" title="attr-input-required"><code>required</code></dfn>
1.1       mike      712:   attribute is a <a href="common-microsyntaxes.html#boolean-attribute">boolean attribute</a>. When specified, the
1.151     mike      713:   element is <dfn id="concept-input-required" title="concept-input-required"><i>required</i></dfn>.</p>
                    714: 
                    715:   <div class="impl">
1.1       mike      716: 
1.67      mike      717:   <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
                    718:   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      719:   element is <i title="concept-input-mutable"><a href="the-input-element.html#concept-input-mutable">mutable</a></i>, and the
1.67      mike      720:   element's <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a> is the empty
                    721:   string, then the element is <a href="constraints.html#suffering-from-being-missing">suffering from being
1.1       mike      722:   missing</a>.</p>
                    723: 
1.151     mike      724:   </div>
                    725: 
                    726:   <div class="example">
1.1       mike      727: 
                    728:    <p>The following form has two required fields, one for an e-mail
                    729:    address and one for a password. It also has a third field that is
1.119     mike      730:    only considered valid if the user types the same password in the
1.1       mike      731:    password field and this third field.</p>
                    732: 
                    733:    <pre>&lt;h1&gt;Create new account&lt;/h1&gt;
1.33      mike      734: &lt;form action="/newaccount" method=post
                    735:       oninput="up2.setCustomValidity(up2.value != up.value ? 'Passwords do not match.' : '')"&gt;
1.1       mike      736:  &lt;p&gt;
                    737:   &lt;label for="username"&gt;E-mail address:&lt;/label&gt;
                    738:   &lt;input id="username" type=email required name=un&gt;
                    739:  &lt;p&gt;
                    740:   &lt;label for="password1"&gt;Password:&lt;/label&gt;
                    741:   &lt;input id="password1" type=password required name=up&gt;
                    742:  &lt;p&gt;
                    743:   &lt;label for="password2"&gt;Confirm password:&lt;/label&gt;
1.33      mike      744:   &lt;input id="password2" type=password name=up2&gt;
1.1       mike      745:  &lt;p&gt;
                    746:   &lt;input type=submit value="Create account"&gt;
                    747: &lt;/form&gt;</pre>
                    748: 
1.151     mike      749:   </div>
                    750: 
                    751: 
                    752:   <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>
                    753: 
                    754:   <p>The <dfn id="attr-input-multiple" title="attr-input-multiple"><code>multiple</code></dfn>
1.1       mike      755:   attribute is a <a href="common-microsyntaxes.html#boolean-attribute">boolean attribute</a> that indicates whether
1.151     mike      756:   the user is to be allowed to specify more than one value.</p>
                    757: 
                    758:   <div class="example">
1.1       mike      759: 
                    760:    <p>The following extract shows how an e-mail client's "Cc" field
                    761:    could accept multiple e-mail addresses.</p>
                    762: 
                    763:    <pre>&lt;label&gt;Cc: &lt;input type=email multiple name=cc&gt;&lt;/label&gt;</pre>
                    764: 
                    765:    <p>If the user had, amongst many friends in his user contacts
                    766:    database, two friends "Arthur Dent" (with address
                    767:    "art@example.net") and "Adam Josh" (with address
                    768:    "adamjosh@example.net"), then, after the user has typed "a", the
                    769:    user agent might suggest these two e-mail addresses to the
                    770:    user.</p>
                    771: 
1.225     sruby     772:    <p><img alt="" height="140" src="images/sample-email-1.png" width="500"></p>
1.1       mike      773: 
                    774:    <p>The page could also link in the user's contacts database from the site:</p>
                    775: 
                    776:    <pre>&lt;label&gt;Cc: &lt;input type=email multiple name=cc list=contacts&gt;&lt;/label&gt;
                    777: ...
                    778: &lt;datalist id="contacts"&gt;
                    779:  &lt;option value="hedral@damowmow.com"&gt;
                    780:  &lt;option value="pillar@example.com"&gt;
                    781:  &lt;option value="astrophy@cute.example"&gt;
                    782:  &lt;option value="astronomy@science.example.org"&gt;
                    783: &lt;/datalist&gt;</pre>
                    784: 
                    785:    <p>Suppose the user had entered "bob@example.net" into this text
                    786:    field, and then started typing a second e-mail address starting
                    787:    with "a". The user agent might show both the two friends mentioned
                    788:    earlier, as well as the "astrophy" and "astronomy" values given in
1.67      mike      789:    the <code><a href="the-datalist-element.html#the-datalist-element">datalist</a></code> element.</p>
1.1       mike      790: 
1.225     sruby     791:    <p><img alt="" height="171" src="images/sample-email-2.png" width="500"></p>
1.1       mike      792: 
1.151     mike      793:   </div>
                    794: 
                    795:   <div class="example">
1.1       mike      796: 
                    797:    <p>The following extract shows how an e-mail client's "Attachments"
                    798:    field could accept multiple files for upload.</p>
                    799: 
                    800:    <pre>&lt;label&gt;Attachments: &lt;input type=file multiple name=att&gt;&lt;/label&gt;</pre>
                    801: 
1.151     mike      802:   </div>
                    803: 
                    804: 
                    805:   <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>
                    806: 
                    807:   <p>The <dfn id="attr-input-maxlength" title="attr-input-maxlength"><code>maxlength</code></dfn>
1.67      mike      808:   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      809:   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      810:   flag</a></span>.</p>
                    811: 
                    812:   <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      813:   value length</a>, then the <a href="infrastructure.html#code-unit-length">code-unit length</a> of the
1.1       mike      814:   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      815:   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      816:   allowed value length</a>.</p>
                    817: 
                    818:   <div class="example">
1.1       mike      819: 
                    820:    <p>The following extract shows how a messaging client's text entry
                    821:    could be arbitrarily restricted to a fixed number of characters,
1.15      mike      822:    thus forcing any conversation through this medium to be terse and
1.1       mike      823:    discouraging intelligent discourse.</p>
                    824: 
1.59      mike      825:    <pre>&lt;label&gt;What are you doing? &lt;input name=status maxlength=140&gt;&lt;/label&gt;</pre>
1.1       mike      826: 
1.151     mike      827:   </div>
                    828: 
                    829: 
                    830: 
                    831:   <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>
                    832: 
                    833:   <p>The <dfn id="attr-input-pattern" title="attr-input-pattern"><code>pattern</code></dfn>
1.1       mike      834:   attribute specifies a regular expression against which the control's
1.67      mike      835:   <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
                    836:   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      837:   checked.</p>
                    838: 
                    839:   <p>If specified, the attribute's value must match the JavaScript <i title="">Pattern</i> production. <a href="references.html#refsECMA262">[ECMA262]</a></p>
                    840: 
                    841:   <div class="impl">
1.30      mike      842: 
                    843:   <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
                    844:   the attribute's value, when compiled as a JavaScript regular
                    845:   expression with the <code title="">global</code>, <code title="">ignoreCase</code>, and <code title="">multiline</code>
                    846:   flags <em>disabled</em> (see ECMA262 Edition 5, sections 15.10.7.2
                    847:   through 15.10.7.4), compiles successfully, then the resulting
                    848:   regular expression is the element's <dfn id="compiled-pattern-regular-expression">compiled pattern regular
                    849:   expression</dfn>. If the element has no such attribute, or if the
                    850:   value doesn't compile successfully, then the element has no
1.58      mike      851:   <a href="#compiled-pattern-regular-expression">compiled pattern regular expression</a>. <a href="references.html#refsECMA262">[ECMA262]</a></p>
1.1       mike      852: 
1.67      mike      853:   <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      854:   either the element's <code title="attr-input-multiple"><a href="#attr-input-multiple">multiple</a></code> attribute is not
                    855:   specified or it does not apply to the <code><a href="the-input-element.html#the-input-element">input</a></code> element
                    856:   given its <code title="attr-input-type"><a href="the-input-element.html#attr-input-type">type</a></code> attribute's
                    857:   current state, and the element has a <a href="#compiled-pattern-regular-expression">compiled pattern regular
                    858:   expression</a> but that regular expression does not match the
1.67      mike      859:   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
                    860:   <a href="constraints.html#suffering-from-a-pattern-mismatch">suffering from a pattern mismatch</a>.</p>
1.30      mike      861: 
1.67      mike      862:   <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      863:   the element's <code title="attr-input-multiple"><a href="#attr-input-multiple">multiple</a></code>
                    864:   attribute is specified and applies to the <code><a href="the-input-element.html#the-input-element">input</a></code>
                    865:   element, and the element has a <a href="#compiled-pattern-regular-expression">compiled pattern regular
                    866:   expression</a> but that regular expression does not match the
1.67      mike      867:   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
                    868:   is <a href="constraints.html#suffering-from-a-pattern-mismatch">suffering from a pattern mismatch</a>.</p>
1.1       mike      869: 
1.50      mike      870:   <p>The <a href="#compiled-pattern-regular-expression">compiled pattern regular expression</a>, when
                    871:   matched against a string, must have its start anchored to the start
                    872:   of the string and its end anchored to the end of the string.</p>
                    873: 
1.1       mike      874:   <p class="note">This implies that the regular expression language
                    875:   used for this attribute is the same as that used in JavaScript,
                    876:   except that the <code title="attr-input-pattern"><a href="#attr-input-pattern">pattern</a></code>
1.50      mike      877:   attribute is matched against the entire value, not just any subset
                    878:   (somewhat as if it implied a <code title="">^(?:</code> at the start
                    879:   of the pattern and a <code title="">)$</code> at the end).</p>
1.1       mike      880: 
1.151     mike      881:   </div>
                    882: 
                    883:   <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      884:   authors should include a <code title="attr-title"><a href="global-attributes.html#the-title-attribute">title</a></code>
1.1       mike      885:   attribute to give a description of the pattern. User agents may use
                    886:   the contents of this attribute, if it is present, when informing the
                    887:   user that the pattern is not matched, or at any other suitable time,
                    888:   such as in a tooltip or read out by assistive technology when the
1.151     mike      889:   control gains focus.</p>
                    890: 
                    891:   <div class="example">
1.1       mike      892:    <p>For example, the following snippet:</p>
                    893:    <pre>&lt;label&gt; Part number:
                    894:  &lt;input pattern="[0-9][A-Z]{3}" name="part"
                    895:         title="A part number is a digit followed by three uppercase letters."/&gt;
                    896: &lt;/label&gt;</pre>
                    897:    <p>...could cause the UA to display an alert such as:</p>
                    898:    <pre><samp>A part number is a digit followed by three uppercase letters.
1.11      mike      899: You cannot submit this form when the field is incorrect.</samp></pre>
1.151     mike      900:   </div>
                    901: 
                    902:   <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      903:   the pattern.  Additional information could also be included, so long
                    904:   as it assists the user in filling in the control. Otherwise,
1.151     mike      905:   assistive technology would be impaired.</p>
                    906: 
                    907:   <p class="example">For instance, if the title attribute contained
1.1       mike      908:   the caption of the control, assistive technology could end up saying
                    909:   something like <samp>The text you have entered does not match the
1.151     mike      910:   required pattern. Birthday</samp>, which is not useful.</p>
                    911: 
                    912:   <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      913:   non-error situations (for example, as a tooltip when hovering over
                    914:   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      915:   occurred.</p>
                    916: 
                    917: 
                    918: 
                    919:   <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>
                    920: 
                    921:   <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
                    922:   the allowed range of values for the element.</p>
                    923: 
                    924:   <div class="impl">
1.1       mike      925: 
                    926:   <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>
                    927: 
                    928:   <p>If the element has a <code title="attr-input-min"><a href="#attr-input-min">min</a></code>
                    929:   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
                    930:   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
                    931:   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
                    932:   defines a <dfn id="concept-input-min-default" title="concept-input-min-default">default
                    933:   minimum</dfn>, then that is the <a href="#concept-input-min" title="concept-input-min">minimum</a>; otherwise, the element has
                    934:   no <a href="#concept-input-min" title="concept-input-min">minimum</a>.</p>
                    935: 
                    936:   <p><strong>Constraint validation</strong>: When the element has a
                    937:   <a href="#attr-input-min" title="attr-input-min">minimum</a>, and the result of
                    938:   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      939:   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      940:   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      941:   <a href="constraints.html#suffering-from-an-underflow">suffering from an underflow</a>.</p>
1.1       mike      942: 
                    943:   <p>The <code title="attr-input-min"><a href="#attr-input-min">min</a></code> attribute also
                    944:   defines the <a href="#concept-input-min-zero" title="concept-input-min-zero">step
                    945:   base</a>.</p>
                    946: 
                    947:   <p>If the element has a <code title="attr-input-max"><a href="#attr-input-max">max</a></code>
                    948:   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
                    949:   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
                    950:   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
                    951:   defines a <dfn id="concept-input-max-default" title="concept-input-max-default">default
                    952:   maximum</dfn>, then that is the <a href="#concept-input-max" title="concept-input-max">maximum</a>; otherwise, the element has
                    953:   no <a href="#concept-input-max" title="concept-input-max">maximum</a>.</p>
                    954: 
                    955:   <p><strong>Constraint validation</strong>: When the element has a
                    956:   <a href="#attr-input-max" title="attr-input-max">maximum</a>, and the result of
                    957:   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      958:   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      959:   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      960:   <a href="constraints.html#suffering-from-an-overflow">suffering from an overflow</a>.</p>
1.1       mike      961: 
1.151     mike      962:   </div>
                    963: 
                    964:   <p>The <code title="attr-input-max"><a href="#attr-input-max">max</a></code> attribute's value
1.1       mike      965:   (the <a href="#concept-input-max" title="concept-input-max">maximum</a>) must not be
                    966:   less than the <code title="attr-input-min"><a href="#attr-input-min">min</a></code> attribute's
1.151     mike      967:   value (its <a href="#concept-input-min" title="concept-input-min">minimum</a>).</p>
                    968: 
                    969:   <div class="impl">
1.1       mike      970: 
                    971:   <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      972:   has a <a href="attributes-common-to-form-controls.html#concept-fe-value" title="concept-fe-value">value</a>, it will either be
                    973:   <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      974:   overflow</a>.</p>
                    975: 
1.151     mike      976:   </div>
                    977: 
                    978:   <p>An element <dfn id="have-range-limitations" title="have range limitations">has range
                    979:   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>
                    980: 
                    981:   <div class="example">
1.1       mike      982: 
                    983:    <p>The following date control limits input to dates that are before
                    984:    the 1980s:</p>
                    985: 
                    986:    <pre>&lt;input name=bday type=date max="1979-12-31"&gt;</pre>
                    987: 
1.151     mike      988:   </div>
                    989: 
                    990:   <div class="example">
1.1       mike      991: 
                    992:    <p>The following number control limits input to whole numbers
                    993:    greater than zero:</p>
                    994: 
                    995:    <pre>&lt;input name=quantity required type=number min=1 value=1&gt;</pre>
                    996: 
1.151     mike      997:   </div>
                    998: 
                    999: 
                   1000:   <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>
                   1001: 
                   1002:   <p>The <dfn id="attr-input-step" title="attr-input-step"><code>step</code></dfn>
1.1       mike     1003:   attribute indicates the granularity that is expected (and required)
1.67      mike     1004:   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     1005:   allowed values. <span class="impl">The section that defines the
                   1006:   <code title="attr-input-type"><a href="the-input-element.html#attr-input-type">type</a></code> attribute's current state
                   1007:   also defines the <dfn id="concept-input-step-default" title="concept-input-step-default">default
                   1008:   step</dfn>, the <dfn id="concept-input-step-scale" title="concept-input-step-scale">step scale
                   1009:   factor</dfn>, and in some cases the <dfn id="concept-input-step-default-base" title="concept-input-step-default-base">default step base</dfn>,
                   1010:   which are used in processing the attribute as described
1.151     mike     1011:   below.</span></p>
                   1012: 
                   1013:   <p>The <code title="attr-input-step"><a href="#attr-input-step">step</a></code> attribute, if
1.228     sruby    1014:   specified, must either have a value that is a <a href="common-microsyntaxes.html#valid-floating-point-number">valid
                   1015:   floating-point number</a> that <a href="common-microsyntaxes.html#rules-for-parsing-floating-point-number-values" title="rules for parsing
                   1016:   floating-point number values">parses</a> to a number that is
                   1017:   greater than zero, or must have a value that is an <a href="infrastructure.html#ascii-case-insensitive">ASCII
1.151     mike     1018:   case-insensitive</a> match for the string "<code title="">any</code>".</p>
                   1019: 
                   1020:   <div class="impl">
1.1       mike     1021: 
                   1022:   <p>The attribute provides the <dfn id="concept-input-step" title="concept-input-step">allowed value step</dfn> for the element,
                   1023:   as follows:</p>
                   1024: 
                   1025:   <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
                   1026:    by the <a href="#concept-input-step-scale" title="concept-input-step-scale">step scale
                   1027:    factor</a>.</li>
                   1028: 
                   1029:    <li>Otherwise, if the attribute's value is an <a href="infrastructure.html#ascii-case-insensitive">ASCII
                   1030:    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>
                   1031: 
1.228     sruby    1032:    <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     1033:    values</a>, when they are applied to the attribute's value,
                   1034:    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
                   1035:    by the <a href="#concept-input-step-scale" title="concept-input-step-scale">step scale
                   1036:    factor</a>.</li>
                   1037: 
                   1038:    <li>Otherwise, the <a href="#concept-input-step" title="concept-input-step">allowed value
                   1039:    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    1040:    floating-point number values</a> when they are applied to the
1.1       mike     1041:    attribute's value, multiplied by the <a href="#concept-input-step-scale" title="concept-input-step-scale">step scale factor</a>.</li>
                   1042: 
                   1043:   </ol><p>The <dfn id="concept-input-min-zero" title="concept-input-min-zero">step base</dfn> is the
                   1044:   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
                   1045:   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
                   1046:   not have a <code title="attr-input-min"><a href="#attr-input-min">min</a></code> attribute
                   1047:   specified or the result of applying that algorithm is an error, in
                   1048:   which case the <a href="#concept-input-min-zero" title="concept-input-min-zero">step base</a>
                   1049:   is the <a href="#concept-input-step-default-base" title="concept-input-step-default-base">default step
                   1050:   base</a>, if one is defined, or zero, if not.</p>
                   1051: 
                   1052:   <p><strong>Constraint validation</strong>: When the element has an
                   1053:   <a href="#concept-input-step" title="concept-input-step">allowed value step</a>, and the
                   1054:   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     1055:   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     1056:   number subtracted from the <a href="#concept-input-min-zero" title="concept-input-min-zero">step
                   1057:   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     1058:   <a href="constraints.html#suffering-from-a-step-mismatch">suffering from a step mismatch</a>.</p>
1.1       mike     1059: 
1.151     mike     1060:   </div>
                   1061: 
                   1062:   <div class="example">
1.1       mike     1063: 
                   1064:    <p>The following range control only accepts values in the range
                   1065:    0..1, and allows 256 steps in that range:</p>
                   1066: 
                   1067:    <pre>&lt;input name=opacity type=range min=0 max=1 step=0.00392156863&gt;</pre>
                   1068: 
1.151     mike     1069:   </div>
                   1070: 
                   1071:   <div class="example">
1.1       mike     1072: 
                   1073:    <p>The following control allows any time in the day to be selected,
                   1074:    with any accuracy (e.g. thousandth-of-a-second accuracy or
                   1075:    more):</p>
                   1076: 
                   1077:    <pre>&lt;input name=favtime type=time step=any&gt;</pre>
                   1078: 
                   1079:    <p>Normally, time controls are limited to an accuracy of one
                   1080:    minute.</p>
                   1081: 
1.151     mike     1082:   </div>
                   1083: 
                   1084: 
                   1085: 
                   1086: 
                   1087:   <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>
                   1088: 
1.225     sruby    1089:   <!-- similar text in the <textarea> section -->
1.151     mike     1090: 
                   1091:   <p>The <dfn id="attr-input-placeholder" title="attr-input-placeholder"><code>placeholder</code></dfn>
1.1       mike     1092:   attribute represents a <em>short</em> hint (a word or short phrase)
                   1093:   intended to aid the user with data entry. A hint could be a sample
                   1094:   value or a brief description of the expected format. The attribute,
1.151     mike     1095:   if specified, must have a value that contains no "LF" (U+000A) or "CR" (U+000D) characters.</p>
                   1096: 
                   1097:   <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>
                   1098: 
                   1099:   <p>The <code title="attr-input-placeholder"><a href="#attr-input-placeholder">placeholder</a></code>
1.1       mike     1100:   attribute should not be used as an alternative to a
1.151     mike     1101:   <code><a href="the-label-element.html#the-label-element">label</a></code>.</p>
                   1102: 
                   1103:   <div class="impl">
1.1       mike     1104: 
                   1105:   <p>User agents should present this hint to the user, after having
                   1106:   <a href="common-microsyntaxes.html#strip-line-breaks" title="strip line breaks">stripped line breaks</a> from it,
1.67      mike     1107:   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     1108:   the empty string and/or the control is not focused (e.g. by
                   1109:   displaying it inside a blank unfocused control and hiding it
                   1110:   otherwise).</p>
1.1       mike     1111: 
1.151     mike     1112:   </div>
                   1113: 
                   1114:   <div class="example">
1.1       mike     1115: 
                   1116:    <p>Here is an example of a mail configuration user interface that
                   1117:    uses the <code title="attr-input-placeholder"><a href="#attr-input-placeholder">placeholder</a></code>
                   1118:    attribute:</p>
                   1119: 
                   1120:    <pre>&lt;fieldset&gt;
                   1121:  &lt;legend&gt;Mail Account&lt;/legend&gt;
                   1122:  &lt;p&gt;&lt;label&gt;Name: &lt;input type="text" name="fullname" placeholder="John Ratzenberger"&gt;&lt;/label&gt;&lt;/p&gt;
                   1123:  &lt;p&gt;&lt;label&gt;Address: &lt;input type="email" name="address" placeholder="john@example.net"&gt;&lt;/label&gt;&lt;/p&gt;
                   1124:  &lt;p&gt;&lt;label&gt;Password: &lt;input type="password" name="password"&gt;&lt;/label&gt;&lt;/p&gt;
                   1125:  &lt;p&gt;&lt;label&gt;Description: &lt;input type="text" name="desc" placeholder="My Email Account"&gt;&lt;/label&gt;&lt;/p&gt;
                   1126: &lt;/fieldset&gt;</pre>
                   1127: 
1.151     mike     1128:   </div>
                   1129: 
                   1130: 
                   1131: 
1.225     sruby    1132: <!--TOPIC:DOM APIs-->
1.151     mike     1133:   </body></html>

Webmaster