accessKey attribute
Sets an access key to an element.
The accessKey attribute is useful if you want to give the user an opportunity to set focus to an element using a keyboard shortcut.
Activating an access key induces additional action for some controls, e.g. in case of button, input:button, input:checkbox and input:radio elements it simulates a mouse click, so it toggles the CHECKED state of input:checkbox and input:radio elements.
Access keys can be activated differently in different browsers:
Typically the form controls and the body object support the accessKey attribute.
Some other elements also support this attribute, but only if the tabIndex attribute is also specified.Internet Explorer: | ALT + accesskey |
Firefox: | SHIFT + ALT + accesskey |
Google Chrome: | ALT + accesskey. |
Safari: | ALT + accesskey. On the Mac platform, use the CTRL + accesskey combination. |
Opera: | use SHIFT + ESC, and when the list appears, use the accesskey assigned to the element |
JavaScript page for this attribute: accessKey. You can find other example(s) there. |
Possible values:
A single character from the keyboard.
Default: this attribute has no default value.
Example HTML code 1:
This example illustrates the use of the accessKey attribute:
|
||||
<input type="text" value="Activate accesskey: '5'" size="30" accesskey="5" /> |
||||
|
||||
Did you find this example helpful?
|
Supported by tags:
a, abbr, acronym, address, applet, area, b, bdo, big, blockQuote, body, br, button, caption, center, cite, code, dd, del, dfn, dir, div, dl, dt, em, embed, fieldSet, font, form, H1, H2, H3, H4, H5, H6, hr, html, i, iframe, img, input:button, input:checkbox, input:file, input:image, input:password, input:radio, input:range, input:reset, input:search, input:submit, input:text, ins, isIndex, kbd, keygen, label, legend, li, listing, map, marquee, menu, nobr, noFrames, object, ol, optGroup, option, p, plainText, pre, q, rt, ruby, s, samp, select, small, span, strike, strong, sub, sup, table, tBody, td, textArea, tFoot, th, tHead, tr, tt, u, ul, var, xmp
External links:
User Contributed Comments