X
X
xxxibgdrgn2018-12-26 15:57:27
Bootstrap
xxxibgdrgn, 2018-12-26 15:57:27

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

1 answer(s)
V
Viktor Shcherbakov, 2018-12-26
@VAShcherbakov

Alternatively add a class using jquery
$("id элемента").addClass("active");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question