Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8364775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:30:25+00:00 2026-06-09T12:30:25+00:00

I wanted to pick one for consistency ( though i don’t think it matters

  • 0

I wanted to pick one for consistency ( though i don’t think it matters ) and went with id….via document.getElementById().

no longer use

  • name attributes for js access
  • form array access

There are multiple posts on this…but just to make life easy and not think about it any more..I’m using ids only.

Are there any issues with this choice?

I don’t care so much about N5 and N6 and W3 specs.

Here are some similar posts:

Best Practice: Access form elements by HTML id or name attribute?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:30:26+00:00Added an answer on June 9, 2026 at 12:30 pm

    In case of usage of id for each form input when you have multiple forms with multiple inputs on one page you’ll should care about uniqueness of identifiers for each input.
    So the identifiers could became long like “my-form-user-name” and “my-other-special-form-user-name”, etc.

    So I would suggest to give an id to form element, retrieve the form by id and then refer to its elements by name. It’s easier to create unique and readable identifiers for a few forms than for 50 fields of 5 forms with 10 fields in each.
    And probably the code will be more readable.

    <h4>Article form</h4>
    <form id="article-form" method="post">
        <label>Title:</label>
        <input name="title" type="text" />
        <label>Text:</label>
        <textarea name="text"></textarea>
        <input type="submit" name="submit" value="Comment" />
    </form>
    
    <hr />
    
    <h4>Support form</h4>
    <form id="support-form" method="post">
        <label>Title:</label>
        <input name="title" type="text" />
        <label>Text:</label>
        <textarea name="text"></textarea>
        <input type="submit" name="submit" value="Submit issue" />
    </form>
    <script type="text/javascript">
        var article = document.getElementById('article-form'),
            ticket = document.getElementById('support-form');
    
        article['title'].value = 'My Article';
        article['text'].value = 'The text of my article...';
    
        ticket['title'].value = 'I found bug at your site';
        ticket['text'].value = 'Bug description...';
    </script>
    

    Fiddle

    But if you’re using labels like in my example and want to use attribute for in them to bind them to inputs, then you’ll need have identifiers for that inputs anyway.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanted to use 6 different textures on a cube, one per side, but
Wanted to know if there was a way one could query shelveset details from
I'm trying to pick up Java and wanted to test around with Java's client/server
I wanted to pick your minds... So I've got this View that allows for
I recently wanted use regex in Cocoa app. But I found that Cocoa does
Wanted to know if someone had a suggestion on code or maybe there's a
Wanted to see if anyone knows how to add props to a image with
Wanted to understand the difference between undef and define a macro as 0. Thanks.
just wanted to ask where I define initial class properties? From other languages I
I wanted to make a Java based web crawler for an experiment. I heard

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.