Html form: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
mNo edit summary |
||
| Line 1: | Line 1: | ||
<< [[Accessibility]] | << [[Accessibility]] | ||
If the | If the <span class="code">submit/reset</span> buttons were replace with the <span class="code">div/a</span> blocks. | ||
Before: | Before: | ||
| Line 25: | Line 25: | ||
* [http://jquery-howto.blogspot.tw/2013/08/jquery-form-reset.html jQuery Howto: jQuery Form Reset] | * [http://jquery-howto.blogspot.tw/2013/08/jquery-form-reset.html jQuery Howto: jQuery Form Reset] | ||
* [http://api.jquery.com/submit/ .submit() | jQuery API Documentation] | * [http://api.jquery.com/submit/ .submit() | jQuery API Documentation] | ||
* [http://api.jquery.com/keypress/ .keypress() | jQuery API Documentation] {{exclaim}} <span class="code" style="font-family: source-code-pro, Consolas, monospace !important; word-spacing: 0; padding: 0 3px; background-color: rgba( 0, 0, 0, .1 ); border-radius: 3px;">keypress</span> event works on div element but not a element. | * [http://api.jquery.com/keypress/ .keypress() | jQuery API Documentation] {{exclaim}} <span class="code" style="font-family: source-code-pro, Consolas, monospace !important; word-spacing: 0; padding: 0 3px; background-color: rgba( 0, 0, 0, .1 ); border-radius: 3px;">keypress</span> event works on <span class="code">div</span> element but not <span class="code">a</span> element. | ||
further reading: | further reading: | ||
Revision as of 16:16, 13 October 2014
If the submit/reset buttons were replace with the div/a blocks.
Before:
<input type='text' name='text1'> <br /> <input type='reset' value='Reset' name='reset'> <input type="submit" value="Submit">
After:
<input type='text' name='text1' tabindex="1"> <br /> <div id="clear_my_form" tabindex="2"><a href="#">reset</a></div> <div id="submit_my_form" tabindex="3"><a href="#">submit</a></div>
takes the Accessibility issues into consideration:
- tabindex: Users are able to press tab key to jump to next form element.
- press space key or enter key to trigger the reset or submit the form.
- press enter key to submit the form in any input box.
used functions:
- jQuery Howto: jQuery Form Reset
- .submit() | jQuery API Documentation
- .keypress() | jQuery API Documentation
keypress event works on div element but not a element.
further reading: