tags:

views:

91

answers:

3

I learned that the name attribute has been deprecated. But this is how I performed exclusive selection of radio buttons on the form. How do I do it now without using JavaScript?

<input type="radio" name="gender" value="male">Male</input>
<input type="radio" name="gender" value="female">Female</input>
+13  A: 

Undo your belief that the name attribute is deprecated.

Name is deprecated on a, applet, frame, iframe, img and map but not on input.

AnthonyWJones
A: 

I simply use jQuery and give all radio elements in same group some class. That way I can select elements with $("input.classname").

Stiropor
That's nice for you, but maybe not everybody uses jQuery....
Hippo
Oops, missread the last sentance. My bad :)
Stiropor
+1  A: 

As far as I know, the name attribute is not deprecated in general, only for certain elements, namely a, applet, form, frame, iframe, img, and map. For those, you're supposed to use the id attribute instead. For input elements, using name is still correct.

Michael Borgwardt