Answers for "check href javascript"

0

check href javascript

// CHECK HREF
const navLinks = document.querySelector(".nav_link");
const navLink = navLinks.getAttribute("href");
const browserHref = window.location.href; // browserHref.search(navLink)

function sliceLink() {
   if (browserHref.includes(navLink)) {
     let searchLink = browserHref.search(navLink); // get position
     let slicedString = browserHref.slice(searchLink); // result
     return slicedString;
   }
}
Posted by: Guest on August-30-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language