when I trying to add a classname into my js code which looks like this
var a = document.querySelectorAll('.nav-tabs');
for(var i=0 ; i<a.length; i++){
a[i].addEventListener('click',function(){
a[i].classList.add("active");
});
}
it show something like Uncaught TypeError: Cannot set property 'className' of undefined and my html looks like this
<nav>
<div class="container" id="container">
<ul class="nav nav-tabs">
<li role="presentation"><a href="#">a</a></li>
<li role="presentation"><a href="#">b</a></li>
<li role="presentation"><a href="#">c</a></li>
</ul>
</div>
</nav>
I'll be so thankful if someone could help me solve this problem. Muchas gracis
`