0
In connection to having both Id and class sector
Why have Id and class sectors if the class sector is more superior and more functional?
2 ответов
+ 7
Because class is mainly used for CSS purpose.
But when you use JavaScript, you surely need a ID.
Like : you defined two buttons : open and close.
Both buttons have same class named btn.
When you will define JavaScript with that class, both buttons will behave same which they are not supposed to....
But you give both of them IDs like open and close.
You can define both independently.
Hope this makes sense to you.
https://www.lifewire.com/what-is-the-id-attribute-3468186
0
Ok..O think I understand.Tank you sir..