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

  • Home
  • SEARCH
  • 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 8931083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:01:51+00:00 2026-06-15T09:01:51+00:00

Possible Duplicate: IE/Chrome: are DOM tree elements global variables here? Description: Hi there I

  • 0

Possible Duplicate:
IE/Chrome: are DOM tree elements global variables here?

Description:

Hi there I just noticed that when I use an id on a form it’s available as a global variable
after this. I tested this on Firefox 17.0 and Google Chrome 23.0 both on a Mac. I was kinda surprised when I saw this!

HTML-Code:

<form class="input-form" id="test">
      <label for="key">Key</label>
      <input type="text" name="key">
</form>

Question:

Does this mean it’s actually a very bad idea to use id’s on a from or am I completely wrong?

Thanks in advance.

  • 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-15T09:01:52+00:00Added an answer on June 15, 2026 at 9:01 am

    If you mean that it’s available in browsers console than it’s ok. It’s just a way browser trying to ease the pain of writing document.getElementById('test'). At least it’s the case with Chrome. If you open the Chrome console (for example on this page) and just type “sidebar” and hit enter, you’ll see that it returns div with id “sidebar”.

    To answer directly to your question: it’s completely normal to use an id on a form (or any other node) for that matter.

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

Sidebar

Related Questions

Possible Duplicate: IE/Chrome: are DOM tree elements global variables here? I just stumbled upon
Possible Duplicate: IE/Chrome: are DOM tree elements global variables here? I am currently working
Possible Duplicate: How to remove border around text/input boxes? (Chrome) Is there a way
Possible Duplicate: Chrome: timeouts/interval suspended in background tabs? Is there a minimum allowed delay
Possible Duplicate: Javascript: How to loop through ALL DOM elements on a page? var
Possible Duplicate: Removing the image border in Chrome/IE9 There is a border around the
Possible Duplicate: Stop chrome from auto styling input type=search I want to add that
Possible Duplicate: Get real image width and height with JavaScript in Safari/Chrome? Is there
Possible Duplicate: Is Chrome's JavaScript console lazy about evaluating arrays? I have the following
Possible Duplicate: check whether internet connection is available with C# I just want to

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.