hermione_dies
Dec 6th 2007, 7:25 pm
I'm trying to have some links load within the same page with jQuery, but it does not seem to differentiate attributes from multiple elements (don't know how to explain it.. heres the code)
<a href="http://website1/">text</a>
<a href="http://website2/">text</a>
<a href="http://website3/">text</a>
<a href="http://website4/">text</a>
<a href="http://website5/">text</a>
$("a").click( function () {
var href = $("a").attr("href");
$("#content").load(href);
return false;
});
When I try this it loads the href from the first <a> tag on the page, I want it to use the one that was clicked on
<a href="http://website1/">text</a>
<a href="http://website2/">text</a>
<a href="http://website3/">text</a>
<a href="http://website4/">text</a>
<a href="http://website5/">text</a>
$("a").click( function () {
var href = $("a").attr("href");
$("#content").load(href);
return false;
});
When I try this it loads the href from the first <a> tag on the page, I want it to use the one that was clicked on