0

How to select class, id and value

When i click on a button, the target element and its parent and parent of parent should be displayed on console with id, class and value.

12th May 2021, 12:29 PM
Harshit Prajapat
Harshit Prajapat - avatar
2 Answers
0
Vanilla Javascript solution https://code.sololearn.com/WK2ilTc7JaKt/?ref=app If that's not what you want please tell more
12th May 2021, 2:27 PM
ACADEMIC
ACADEMIC - avatar
0
With a dot notation a.id //returns a id value a.class // returns a class value a.id = "identity" //sets a id to identity a.class = "classic" //sets a class to classic
20th May 2021, 7:13 AM
đŸ‡źđŸ‡± Radin Masiha đŸ‡źđŸ‡±
đŸ‡źđŸ‡± Radin Masiha đŸ‡źđŸ‡± - avatar