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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:31:23+00:00 2026-06-07T16:31:23+00:00

JavaScript’s getElementById is ok to use, I know that. But how about getElementsByClassName ?

  • 0

JavaScript’s getElementById is ok to use, I know that. But how about getElementsByClassName? How is the browser support for that?

Through Google I’ve found various homemade solutions for it, like this

As you can see, this post is four years old now, that’s why I am asking. Or should I just use jQuery for stuff like that if it’s available?

  • 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-07T16:31:25+00:00Added an answer on June 7, 2026 at 4:31 pm

    First off, you have to identify exactly which version of IE you need to support: IE6, IE7, IE8? We can’t really provide the best set of options without knowing that. If all you need is IE9 and above (IE8 too in some modes), then you can use document.querySelectorAll(".classname") or document.getElementsByClassName("classname").

    If you need other versions of IE, you can’t go that route. There are shims for getElementsByClassName() that are less than 30 lines of code that can be used to provide support for it in older versions of IE, but at that point, I’d strongly suggest you just get a selector library that does ALL the cross browser support for you. It sounds like you are already familiar with jQuery which has such a library. If you don’t want/need the rest of jQuery, you can get just a selector library. jQuery uses Sizzle internally which is available all by itself and is quite good. There are also others.

    Here’s a good resource so you can look up browser compatibility on your own: http://caniuse.com/getelementsbyclassname.

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

Sidebar

Related Questions

javascript with> var customer=document.getElementById('custList').value; and that works... Why does it work BUT... var customer=(form1.custList.value);
JavaScript is known to be single-threaded in all modern browser implementations, but is that
Javascript I have code that will hide various sections in a MS CRM form
Javascript can manipulate the document the browser is displaying, so the following: <script> document.write(<table><tr><td>Hola</td><td>Adios</td></tr></table>);
JavaScript's late binding is great. But how do I early bind when I want
I am reading a book about Javascript and jQuery and using one of the
JavaScript is a lightweight and powerful language, but it's often misunderstood and hard to
Javascript passes objects by reference. This makes perfect sense. But once you start manipulating
JavaScript object created with a prototype maintains live connection to its prototype, so that
JavaScript: .replace(/_/g, ); I have it in my code but can't remember why or

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.