JQuery listen to click and alert with clicked element's href

javascript, jquery

Solution

Like this:

$(".js").click(function (e) {
    alert('this elements href is: ' + $(this).attr('href'));
}

Problem

The title is pretty self explanatory. ``` $(".js").click(function (e) { alert('this elements href is: ' + href); }); ``` How do I replace 'href' with the clicked element's href?

Original source