开发者

Get attr form <a href>

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="10开发者_JAVA技巧0%" 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').


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜