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>
From stackoverflow
-
Undo your belief that the name attribute is deprecated.
Name is deprecated on a, applet, frame, iframe, img and map but not on input.
-
I simply use jQuery and give all radio elements in same group some class. That way I can select elements with $("input.classname").
Hippo : That's nice for you, but maybe not everybody uses jQuery....Stiropor : Oops, missread the last sentance. My bad :) -
As far as I know, the
nameattribute is not deprecated in general, only for certain elements, namelya, applet, form, frame, iframe, img,andmap. For those, you're supposed to use theidattribute instead. For input elements, usingnameis still correct.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.