Johnc
Johnc

Reputation: 56

asp.net associate two label controls to one text box

I am trying to get two label controls to be associated with one text box. This way when the screen reader is in the text box it states both labels. The example of this is the text box label and another label on the other side of the text box with data entry format help text. Strangely this works else where on the site, but when I try to duplicate the control set up it still does not work. Anyone have any suggestions on how to do this? Thanks.

Upvotes: 1

Views: 424

Answers (1)

unobf
unobf

Reputation: 7254

There are two ways to do this:

<label>
    Text before
    <input ... />
    Text after
</label>

or

<div id="inputbefore">Text before</div>
<input aria-labelledby="inputbefore inputafter" ... />
<div id="inputafter">Text before</div>

Upvotes: 1

Related Questions