0

Since I was told my post is a re-post, which it is not, let me re-explain:

I have a div 'box'. In this 'box', there is a 'contentbox' div. In that 'contentbox' there is, by default, a form and a button 'button1'.

When 'button1' is clicked, a new form 'questions' and a new button 'button2' is loaded into 'contentbox'.

'button2' will not click and load more html.

When trying to follow the link that I was apparently "reposting" I changed my JQuery to...

$("#button2").on('click', "#contentholder, loadQuestions());

I want my dynamically loaded button to be able to dynamically create other dynamic content. That way, all processes can occur within my 'contentbox'.

If you still believe I need to go back and look at that post, please be more specific on what I am actually doing wrong. It takes a long time to create these posts, and to simply tell me "repost" does not get me anywhere.

Thank you

JFiddle Demo(With html): http://jsfiddle.net/u1hfu3yc/1/

        $(document).ready(function () {
        $("#button1").click(loadUserNameTable);
        $("#button2").click(loadQuestions);
        $("#button3").click(loadPasswordChange);
        $("button4").click(submit);
    });

    function loadUserNameTable() {
        $("#contentholder").load("nametable.html");
    }
    function loadQuestions() {
        $("#contentholder").load("questions.html");
    }
    function loadPasswordChanger() {
                    $("#contentholder").load("passwordchange.html");
    }
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Christopher
  • 790
  • 12
  • 30
  • you need to use event delegation – David Fregoli Jan 22 '15 at 14:37
  • Please be more specific on how this applies to my question, where do I need event delegation, why do I need it, assuming I don't know what event delegation is, please attempt to show me. – Christopher Jan 22 '15 at 15:46
  • I disagree with your statement that you read the linked 'duplicate' question. I think that you got there and decided it was too long to read it all, or you weren't concentrating enough to call what you did 'reading'. I'm not saying this to be insulting -- my intent is to point out that actually there is a very clear high-quality answer by Ronen Rabinovici that explains in detail how to solve your problem. Your question /is/ a duplicate of that question, and that particular answer contains a very clear explanation of your problem and how to solve it. Please read it again. – Software Engineer Jan 22 '15 at 16:33
  • I did read the top 3 solutions on that page, but they did not help for the following reason: I need to load a new div (using the load method) into an existing
    when a button is pressed. Even if I followed the order that Ronen provided and coded `code` $('#staticContainerId').on('click', "#newDivId", functionx) then in the function-- `code` functionx(){$('#contentHolderId').load('nextHtmlPage.html'); it will not work.
    – Christopher Jan 22 '15 at 18:21

0 Answers0