Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Where Does The "name" Attribute Stand?

Where Does The "name" Attribute Stand?

Where Does The "name" Attribute Stand?

I've been away from JS for a while. I'm getting back into it for a project. The last time I remember working on something form-related. I remember reading back then that the getElementsByName() method was deprecated for everything except forms.
I go back to w3schools today to refresh my memory, and it says the "name" attribute is deprecated and to use the "id" attribute instead:
That sounds like it's deprecated for all instances. That sounded a little extreme so I also checked out the Mozilla Developer site:
They mention that it can only be used in XHTML documents.
Is the "name" attribute still valid for forms?

RE: Where Does The "name" Attribute Stand?

The name attribute isn't going anywhere any time soon. That's for sure.

As far as I know, the only way to get radio buttons to work as a group is by including the name attribute.

<input type="radio" name="ShoeSize" value="9">9
<input type="radio" name="ShoeSize" value="10">10
<input type="radio" name="ShoeSize" value="11">11

You can give each radio button an id if you choose to. However, if you want the user to only select one shoe size, you must include the name attribute.

Microsoft SQL Server MVP
My Blogs
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close