Quiz Question 1 of 6
What's the benefit of using a custom data-*
attribute to select an element with JavaScript and a class to target the element with CSS?
Choose the correct answer below:
-
A
You can trigger functionality on the page only with
data-*
attributes, while classes can only style an element. -
B
Separation of concerns. The
data-*
attribute has the job of providing JavaScript functionality, while the class has the job of styling the element. -
C
Using a
data-*
attribute to select an element with JavaScript and a class to target the element with CSS has no benefits. -
D
You can select an element with JavaScript using a selector that's also used in your CSS.