0

The following element from browser inspector is shown on a button:

<label _ngcontent-nyq-c70="" translate="" class="font-family-title label">BET</label>

I am trying to get the label 'BET' using the following:

var test = document.getElementsByClassName("font-family-title label")[0].innerText;
console.log("test is: "+test);

It returns undefined. The website is https://spribe.co/games/aviator

user3560827
  • 632
  • 1
  • 5
  • 22
  • Does this answer your question? [Javascript can't find element by id?](https://stackoverflow.com/questions/4498482/javascript-cant-find-element-by-id) – Justinas Dec 19 '22 at 11:27
  • nope, windows.onload function doesn't work, would really appreciate visiting the site and trying it out if you can – user3560827 Dec 19 '22 at 11:31
  • How about you just edit your question with minimal example of the issue? Because your code is working fine and I am not going to random sites for virus database update. – Justinas Dec 19 '22 at 11:37
  • Your Javascript it fine, make sure you don't have multiple elements with the same class and that your scripts run after the elements are added to the document. – Jostein S Dec 19 '22 at 12:06
  • please try at https://spribe.co/games/aviator because I've tried all options – user3560827 Dec 19 '22 at 12:08
  • @user3560827 Having to visit external sites to reproduce the problem [is not allowed on Stack Overflow](https://meta.stackoverflow.com/questions/254428/something-in-my-web-site-or-project-doesnt-work-can-i-just-paste-a-link-to-it). Please add a [mcve] into the question itself. – Ivar Dec 19 '22 at 12:29

0 Answers0