Reputation: 11
ive got a problem with getting attr from <a href>
.
Got something likte this
<a href="#callback" realurl="callback.aspx">Callback</a>
And jQuery
$('#callback').bind('pageAnimationEnd', function (e, info) {
var realurl = $(this).attr('realurl');
if (!$(this).data('loaded')) {
$(this).append($('<table border=0 width="100%" height="100%"><tr width="100%" height="100%"><td>Wczytuję...</td></tr></table>').
load(realurl, function () {
$(this).parent().data('loaded', true);
$('#ParentTest').html("test");
}));
}
});
And im getting all the time undefined from $(this).attr('realurl').
Upvotes: 1
Views: 489
Reputation: 31961
This does not work the way you intend.
$('#callback')
finds the elements having id="callback"
. So if your HTML would be like:
<a id="callback" href="#callback" realurl="callback.aspx">Callback</a>
it would work. Alternatively, you can leave the html as is and write:
$("a[@href='#callback']")
instead. This should get all a
elements having the href
attribute set to #callback
Upvotes: 9