vendredi 3 juin 2016

How can I get the value of an element inside a span?

I'm trying to extract a game score from the console for a JS game.

document.getElementById("game").getElementsByClassName("game-score")

This returns the span which contains the score, which is:

<span class="game-score" score="550"></span>

I'm trying to extract the score element, so I want just the 550 returned. Is there an easy way to do this?




Aucun commentaire:

Enregistrer un commentaire