Where is the best place to declare the active class of an element?
-
Please tell me where it is better to declare a default active class for an element.
In the HTML itself<li class="fitler_item active_filter" data-filter="all">All</li>
or in jsif (indx == 0) { items.classList.add('active_filter') }
JavaScript Anonymous, Jun 13, 2020 -
if this element is always active by default, then it is better in htmlAnonymous
-
Best in css I think.Anonymous
2 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!