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 6699883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:44:56+00:00 2026-05-26T06:44:56+00:00

document.getElementById(‘frmMain’).elements can i use like this document.getElementByName(‘frmMain’).elements or document.getElementBytag(‘table’).elements`

  • 0
 document.getElementById('frmMain').elements

can i use like this

document.getElementByName('frmMain').elements 

or

document.getElementBytag('table').elements`
  • 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-05-26T06:44:57+00:00Added an answer on May 26, 2026 at 6:44 am
    • document.getElementById(‘frmMain’).elements
      assumes the form has an ID and that the ID is unique as IDs should be. Although it also accesses a name attribute in IE, please add ID to the element if you want to use getElementById

    • document.getElementsByName(‘frmMain’)[0].elements
      will get the elements of the first object named frmMain on the page – notice the plural getElements – it will return a collection.

    • document.getElementsByTagName(‘form’)[0].elements
      will get the elements of the first form on the page based on the tag – again notice the plural getElements

    A great alternative is

    • document.querySelector(“form”).elements
      will get the elements of the first form on the page. The “form” is a valid CSS selector

    • document.querySelectorAll(“form”)[0].elements
      notice the All – it is a collection. The [0] will get the elements of the first form on the page. The “form” is a valid CSS selector

    In all of the above, the .elements can be replaced by for example .querySelectorAll("[type=text]") to get all text elements

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

Sidebar

Related Questions

I want to use document.getElementById in the src of script tag like this: <div
I'm doing something like this: alert(document.getElementById('cardNumber').value); And it alerts cardNumber value. But I need
It looks like this: var objDiv = document.getElementById(code); objDiv.scrollTop = objDiv.clientHeight; works in Chrome,
So for example I can do this: document.getElementById('element').onclick = function() { document.getElementById('element').style.color = '#FFFFFF';
var input = document.getElementById('thumbimg'); input.addEventListener('change', function() { $(input.imgcheck).attr(disabled, ); }, false); I use this
if(document.getElementById('txt1') != null){ $(#txt1).val(document.getElementById('txt1').value.toUpperCase()); } How can i convert this statement to Jquery Completely
When I use document.getElementById in Internet Explorer I get this error: Mensaje: El objeto
document.getElementById(...).setAttribute('style',... is not working in Internet Explorer 7.0. How can I make this work
Using document.GetElementById(thingieID) doesn't seem to work. Can anyone help this DOM newbie?
I am getting document.getElementById(#toHide) is null. How can solve this? how to convert this

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.