By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,678 Members | 1,074 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,678 IT Pros & Developers. It's quick & easy.

How can one put an accesskey on a Select (Drop down box)

P: n/a
Jim
Hi,

How can one put an accesskey on a Select (Drop down box) in a form using
XHTML 1.0? It wont validate as follows:

<select accesskey="r" tabindex="3" name="state" size="1">

I can put an accesskey on radio buttons, and text fields without issue.

Thanks

Jim
Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Jim wrote:
How can one put an accesskey on a Select (Drop down box) in a form using
XHTML 1.0? It won₼t validate as follows:

<select accesskey="r" tabindex="3" name="state" size="1">


<label accesskey="r">State:
<select tabindex="3" name="state">
<option>...</option>
</select>
</label>

Or, if your concerned about the label working properly in IE, then you
have to reference the control with the id, using the for attribute.

<label accesskey="r" for="state">State:</label>
<select tabindex="3" id="state" name="state">
<option>...</option>
</select>

--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://SpreadFirefox.com/ Igniting the Web
Jul 23 '05 #2

P: n/a
Jim
On Thu, 18 Nov 2004 16:04:19 GMT, Lachlan Hunt wrote:
Jim wrote:
How can one put an accesskey on a Select (Drop down box) in a form using
XHTML 1.0? It won₼t validate as follows:

<select accesskey="r" tabindex="3" name="state" size="1">


<label accesskey="r">State:
<select tabindex="3" name="state">
<option>...</option>
</select>
</label>

Or, if your concerned about the label working properly in IE, then you
have to reference the control with the id, using the for attribute.

<label accesskey="r" for="state">State:</label>
<select tabindex="3" id="state" name="state">
<option>...</option>
</select>


Thanks, that validated and works. I used your second approach, but used an
empty label as I have the true "State" label in a difference cell.

Jim
Jul 23 '05 #3

P: n/a
Jim wrote:
On Thu, 18 Nov 2004 16:04:19 GMT, Lachlan Hunt wrote:
<label accesskey="r" for="state">State:</label>
<select tabindex="3" id="state" name="state">
<option>...</option>
</select>

Thanks, that validated and works. I used your second approach, but used an
empty label as I have the true "State" label in a difference cell.


Then put the label the cell where the actual label is. They don't need
to be together as I wrote them, it is fine to seperate them like this,
or any other structure, as long as it conforms to the spec:

<td><label accesskey="r" for="state">State:</label></td>
<td>
<select tabindex="3" id="state" name="state">
<option>...</option>
</select>
</td>
--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://SpreadFirefox.com/ Igniting the Web
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.