How to run a class in html and javascript?
How do I run <div class = ""></div> when a button is pressed?
Voters
PattanAhmed (1367)
@MatthewX Hi,
This is an amazing website explaining about Classes (div) in HTML and JavaScript...
Click here
Hope this helps
Please mark my answer if this helps
SixBeeps (3527)
Classes in HTML are different than classes in any other language. Here, they are used for grouping together common elements or groups of elements so that they can be styled or identified in bulk.
Hi! Classes are not the same as
id
s. They can be assigned to multiple elements so they can be identified as a group.Anyways, to get all elements:
@Coder100 What does this code mean? sorry, but I am still a newbie.
@Coder100 nvm i dont need this i realized the code still works.
@Coder100 How would you add an item to a list in javascript?
um, using
append
@MatthewX@Coder100 wait how
@Coder100 Also should i add anything else to the pokemon game? Or what should i improve on?
https://www.w3schools.com/jsref/met_node_appendchild.asp
@MatthewX
there ya go @MatthewX
@Coder100 thx!
np! @MatthewX
@Coder100 wait so how would i do this to store the pokemon the player has?
@Coder100 um, do you know how to move a character with html and javascript?
@Coder100 how come adding the pokemon to the list says the list is still empty? Can u check in the code?