Hi Friends, I want my user to be able to use Keyboard shortcut keys for selecting value from drop down Can it be done? If so, please give some clues.. Suppose there is a drop-down menu for selecting a country: Say it has a list like India, US, Switzerland, Australia. I want to allow my user select a country by focussing on the dropdown and by hitting the HIGHLIGHTED character of the country in the keyboard. Please note the highlighted letter can be anywhere in the work.. Thanks a lot for the help.. Regards,
Use the HTML attribute acesskey <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Use of acesskey</title> </head> <body> <form> <select name=""> <option acesskey="i" selected="selected">(I)ndia</option> <option acesskey="u">(U)S</option> <option acesskey="w">(S)witzerland</option> <option acesskey="a">(A)ustralia</option> </select> </form> </body> </html> Code (markup):
Hi Maujor, Thanks a lot.. But the <option> doesn't seem to have accesskey attribute.. The following elements support the accesskey attribute: A, AREA, BUTTON, INPUT, LABEL, and LEGEND, and TEXTAREA. Added rep for your help.. Regards,
You are right. Sorry! The attribute that assigns keyboard shortcuts to HTML elements is ACCESSKEY, but I didn't check which elements support it. So, my fault :-( It seems that there isn't a way to achieve what you are intend via HTML markup. Further reading: http://www.w3.org/TR/REC-html40/index/attributes.html