I am making use of matching a url from a tab to the window.location, but am using secure routes. How do I remove the a part of a string from a selected character, In my case the char is ‘?’ I want to remove everything from the ? to the end of the string. How can this be done with jquery?
document.querySelectorAll('.nav-link').forEach(link => {
console.log(link);
if(link.href === window.location.href){
link.setAttribute('aria-current', 'page')
}
})
2
Answers
you can use the split function simply like this