Answer the question
In order to leave comments, you need to log in
How to assign class active to nav-link?
There is a navbar on bootstrap 4. It has several nav-item elements. I would like to know how you can assign the active attribute to the nav-item element, but not by clicking on it, but depending on the value of a certain variable. That is, for example, if the variable a = 0, then make one element active, if a = 1, then another.
Answer the question
In order to leave comments, you need to log in
Alternatively add a class using jquery$("id элемента").addClass("active");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question