+ 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

25th Apr 2018, 1:13 AM
Octavio Aguayo
Octavio Aguayo - avatar
3 ответов
+ 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:
25th Apr 2018, 1:22 AM
Faisal
Faisal - avatar
+ 1
Thank you
25th Apr 2018, 1:33 AM
Octavio Aguayo
Octavio Aguayo - avatar
+ 1
This will make that I can make this game more quickly
25th Apr 2018, 1:33 AM
Octavio Aguayo
Octavio Aguayo - avatar