I am trying to retrieve the href attribute from a link. However, it keeps returning undefined.
This is the html, generated via ajax which I why the .on function does not work in jQuery
html += '<a class="viewOffer" href="singleOffer/'+ value.id + '">View offer</a></td>';
This is the jQuery function
$( ".viewOffer" ).click(function() {
alert($(this).attr('href'));
});
Thanks!