How to verify html "Tags" by JavaScript for some basis. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to verify html "Tags" by JavaScript for some basis.

I have two button tags in html; each have different name and i want to verify them through JavaScript. How can i do this?

22nd Mar 2018, 3:08 PM
Praveen Soni
Praveen Soni - avatar
2 Answers
+ 3
What are you wanting to verify about the buttons? document.getElementsByTagName('button') ^That'll retrieve any buttons on your page. document.getElementsByName("elementName"); ^That'll retrieve the individual button based upon its name. document.getElementById("elementID"); ^That'll retrieve the individual button based upon its ID. document.getElementsByClassName("elementClass"); ^^That'll retrieve the individual button based upon its class. Hope that helps. Give me more information if you have a more specific question about verification.
22nd Mar 2018, 3:14 PM
Fata1 Err0r
Fata1 Err0r - avatar
0
can you give me more tricks about JavaScript @jakob
24th Mar 2018, 5:23 AM
Praveen Soni
Praveen Soni - avatar