0

Hello I am redesigning my site and one of my goals is getting off the jQuery library. Vanilla JS has proved a tougher challenge than I hoped for. I need to prevent the nav links from going to a different page and run a function. heres what I have so far but not even the preventDefault is working. Please help!

$navlinks = document.querySelectorAll('nav a');
$navlinks.onclick = function(event){
  event.preventDefault();
  this.blur();
  //function here
}
sallycakes
  • 176
  • 2
  • 11

0 Answers0