Why there is 'id' selector? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why there is 'id' selector?

Because, 'class' also get the job done easily and more efficiently!

22nd Jun 2018, 2:33 PM
Çůřîöş ßąšäñț 🇮🇳
Çůřîöş ßąšäñț 🇮🇳 - avatar
5 Answers
+ 5
well Kaimi is right, ID is meant for specific selection of a single element using JavaScript (also for a label tag and I think the map tag), if you use JavaScript to select a class you would select all of the elements with that class or have to cycle through the elements to see which one is the element you want to use so as Kaimi said, they are easier to select by JavaScript
23rd Jun 2018, 6:19 AM
MCJEH
MCJEH - avatar
+ 1
Kaimi Sorry, but I'm not asking for the difference between 'id' and 'class'.
22nd Jun 2018, 3:59 PM
Çůřîöş ßąšäñț 🇮🇳
Çůřîöş ßąšäñț 🇮🇳 - avatar
0
id="abc" #abc{ your code }
7th Jul 2018, 2:07 AM
Abdou Aziz NDAO
Abdou Aziz NDAO - avatar
0
id preticulller is one time used in all progrram
7th Jul 2018, 8:15 AM
raj