How can I get the URL of a link?

advertisements

How can I get the URL of a link?

$('.l').eq(0).href

is what I want to do, but it's undefined.


So given a jQuery selected anchor element, how do you get the href property?


Try:

$('.l').eq(0).attr("href")