0
document.getElementById("panel11-7-b").getElementsByClassName("btn btn-danger btn-lg  btn-block betButton").click();

I am trying to make it click a button but it says:

Uncaught TypeError: document.getElementById(...).getElementsByClassName(...).Click is not a function at :1:109

TofferJ
  • 4,678
  • 1
  • 37
  • 49
ЯАR
  • 21
  • 1
  • 2

2 Answers2

4

getElementsByClassName() returns a collection, you can't call click() on it.

you need to traverse through the collection and call click on individual elements.

Ramanlfc
  • 8,283
  • 1
  • 18
  • 24
1

Oh I solved my own problem lol

document.getElementById("panel11-7-b").getElementsByClassName("btn btn-danger btn-lg btn-block betButton")[0].click();

ЯАR
  • 21
  • 1
  • 2