I have to select multiple elements, all them have the class ="org-box". Inside that box there is a link a that I want to capture the href. So I do this
$("a.org-box").click(function (e) {
e.preventDefault();
var link = $(e).html();
$('.col-right').prepend("<b>" + link +"</b>");
})
What I always get is null, and I have tried other selectors like
var link = $(e.a).attr("href").html();
With the same luck.
I checked what I get from that selection $("a.org-box")
and I get this -> b.fn.b.init[102]
If I do this $("a.org-box:first").attr("href");
I get correctly the href, but when I do $("a.org-box").attr("href");
I just get the first one.
What Im doing bad ?? How to select all the a.org-box and capture href on click ?
jQuery
or$
) returnsjQuery.fn.init
, but because they're sourced from minified code the name will show up asb.fn.b.init
. – zzzzBov