Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to disable a label tag in javascript

i need to create five labels using <label> tag in html. then when any one of the label is clicked all the other four labels must be disabled. i have searched through the google but could not find how to disable label tag. is there any way to do that .any suggestion......

<label for="u">username1</label>
<label for="u">username2</label>
<label for="u">username3</label>
<label for="u">username4</label>
<label for="u">username5</label>
like image 817
mere Avatar asked May 27 '11 07:05

mere


1 Answers

Before looking at your example, I would have said:

A label can't be disabled. One of the effects it has is to extend the click target of a form control, so you probably want to disable the form control instead.

However, for some reason, all your labels are associated with the same control (the one with id="u"), which suggests that you aren't using <label> correctly. It is possible to have multiple labels for a single control, but it doesn't look like you are doing that.

You should probably take a step back and describe the problem that you think disabling a label will solve.

like image 105
Quentin Avatar answered Oct 25 '22 16:10

Quentin