+ 2
Can I manipulate HTML with JS?
I want to make that when a button is pressed, the number of a <p> 100</p>, change to 80 or something like that. I want to make a Pokemon battle game. You can find it like: Pokemon Rivals By: Oki05 https://code.sololearn.com/W6TLxXv77jK1/?ref=app
3 Respuestas
+ 3
For changing text within an element in HTML, you could use the .innerHTML method of accessing whatever text is within that HTML element and manipulating it. You would need to reference the element via either its class/id or its tag:
var health1 = document.getElementById("Numero_de_Vida_Pic");
health1.innerHTML = 80;
Hope this helped! d:
+ 1
Thank you
+ 1
This will make that I can make this game more quickly