frosty
frosty

Reputation: 5370

Cannot get jQuery click handler to fire on ajax loaded element

"MyParentPage.htm" uses the load function of jquery to load('myDiv.htm') //

myDiv.htm only contains:

<a href="#" class="bt-cbox">Click me</a>

I have the following in "MyParentPage.htm"

$(document).ready(function() {    
    $(".bt-cbox").click(function() {    
        alert("handler hit");
    });
});

Why is the my alert not being hit

Upvotes: 0

Views: 881

Answers (1)

rahul
rahul

Reputation: 187050

$(document).ready(function() {
    $(".bt-cbox").live("click",function() {
        alert("handler hit");
    });
});

See live

Upvotes: 6

Related Questions