A certain <a>
element with dynamic URL has a unique CSS ID.
How could I use this CSS ID to know what is the current URL of this link, with vanilla JavaScript?
A certain <a>
element with dynamic URL has a unique CSS ID.
How could I use this CSS ID to know what is the current URL of this link, with vanilla JavaScript?
This worked for me to get the URL by selector:
let editButton = document.querySelector('#myCSSID').href;
I printed it in console this way:
console.log(editButton);
getElementById
would also work.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.