Short URL: http://html5.org/r/7091
| SVN | Bug | Comment | Time (UTC) |
|---|---|---|---|
| 7091 | example for type=number | 2012-05-07 22:13 |
Index: source =================================================================== --- source (revision 7090) +++ source (revision 7091) @@ -55867,7 +55867,31 @@ </div> + <div class="example"> + <p>Here is an example of using a numeric input control:</p> + + <pre><label>How much do you want to charge? $<input type=number min=0 step=0.01 name=price></label></pre> + + </div> + + <p class="note">The <code title="">type=number</code> state is not + appropriate for input that happens to only consist of numbers but + isn't strictly speaking a number. For example, it would be + inappropriate for credit card numbers or US postal codes. A simple + way of determining whether to use <code title="">type=number</code> + is to consider whether it would make sense for the input control to + have a spinbox interface (e.g. with "up" and "down" arrows). Getting + a credit card number wrong by 1 in the last digit isn't a minor + mistake, it's as wrong as getting every digit incorrect. So it would + not make sense for the user to select a credit card number using + "up" and "down" buttons. When a spinbox interface is not + appropriate, <code title="">type=text</code> is probably the right + choice (possibly with a <code + title="attr-input-pattern">pattern</code> attribute).</p> + + + <h6><dfn title="attr-input-type-range">Range</dfn> state (<code title="">type=range</code>)</h6> <div class="impl">