468,545 Members | 1,741 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,545 developers. It's quick & easy.

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

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
3 5909
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
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
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.

Similar topics

4 posts views Thread by Nanos | last post: by
9 posts views Thread by Udo Marx | last post: by
5 posts views Thread by Isha | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by UniDue | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.