Questions tagged [getelementsbyclassname]

getElementsByClassName is a Javascript function which takes a string argument and returns elements from the current page with a class name matching the string. It is generally used to gather DOM elements for further manipulation.

getElementsByClassName() is a function which

[r]eturns a set of elements which have all the given class names. When called on the document object, the complete document is searched, including the root node. You may also call getElementsByClassName on any element; it will return only elements which are descendants of the specified root element with the given class names. – (Mozilla Developer Network documentation)

664 questions
-5
votes
1 answer

A code with "getElementsByClassName( )[ ]" with square bracket? What does it do? How can it be converted to jQuery?

I have a code in the snippet that has a document.getElementsByClassName("close")[0], what the [0] is doing? I never seen a square brackets being used in getElementsByClassName for what purpose is it used for? Also, how can I convert it to…
MestreALMO
  • 141
  • 4
  • 14
DOCUMENT CODE: Dim h1 As…
-5
votes
2 answers

Html tags inside Div/Class

i Just want to Print Tags+txt/htmls this:->
1NJ3CT0R
  • 41
  • 5
-5
votes
2 answers

getElementsByClassName confusing issue

Can someone explain getElementsByClassName, because I thought I was using it correctly, but I am having issues. For instance, the following code doesn't make the hidden elements visible: var actionButtons =…
Dave M
  • 418
  • 3
  • 15
1 2 3
44
45