Given the following anchor:
<a class="example" href="record1234">link</a>
How can the actual value of href
be retrieved with vanilla Javascript?
const link = document.querySelector('.example');
console.log(link.href);
// https://exampledomain.com/current/document/path/record1234
console.log(link.pathname)
// /current/document/path/record1234
// with jQuery
$('.example').attr('href');
// what I want to do:
console.log(link.href.string); // record1234