Given an anchor element (with something like $("a:first")
), how do you get the absolute URL that the anchor points to?
If you're using jQuery 1.6+, you can use .prop()
:
$("a:first").prop("href")
Prior to 1.6, you can access the href
property directly on the DOM element:
$("a:first")[0].href;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With