开发者

jquery can fire function issue with live

I have the following function that loads "mypage.htm" into "#flowplayer-content".

开发者_运维知识库This works

 $('.small-images a').bind("click", function(event) {

    var uri = "mypage.htm";
    $("#flowplayer-content").load(uri, null, function(responseText, textStatus, XMLHttpRequest) {

    });
    event.preventDefault();
});

"mypage.htm" contains ahref. I want to call this event.

$("a").live("click", function() {
    alert("handler hit");
});

but i can't seem to hit it


When do you call the live method? This should be called before the new HTML is loaded.

Also, the way you are doing it now affects all links, even the one that loads the html. Am I right to guess that you are using a different selector in the real thing?

Perhaps, it will be better to post the full source (javascript + html).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜