3

I have a main page from where I am making a call to "load" and intermediate page's HTML and on the completion of the load I am massaging the returned HTML to add a few DIVs etc, when I try to bind an onclick event for the dynamic Divs (added by me after the HTML returned from the intermediate page) it does not seem to work at all !:

LOAD :

$j(".loader").load(myURLtoIntermediatePage, '', function() {
     var HTML= '<div id="abcd">test</div>';
     ...

     $j(".pageDIV").append(HTML);    
}

DOCUMENT READY Function

$j(document).ready(function() {

 $j('#abcd').onclick(function() {
            alert($j(this));
        });

});

1 Answer 1

7

This requires jQuery 1.3:

$j("#abcd").live("click", function() {
    alert($j(this));
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.