I have a nav with 5 buttons, and a footer with the same amount, when clicking the footer buttons they serve as anchor for the page, but I need to compare with the nav items to be added to the class "Activate them ".
Only returning me
btnnav[i].attr("href")
is not a function
What to do?
$('footer li a').click(function(){
var hfooter = $(this).attr("href");// Guarda o href desse botao no footer
var btnnav = $(".btn-nav");//cria um array com todos os botoes da nav
btnnav.removeClass("active");//tira a classs active deles
for (var i = 0; i <= btnnav.length; i++) {
if (btnnav[i].attr("href") === hfooter){
/*Ao percorrer o array de classes ele deve buscar o que tem o
href igual o botao que foi clicado, quando encontrar,
vai adicionar a class active*/
btnnav[i].addClass("active");
}
}
});