Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8917147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:25:03+00:00 2026-06-15T05:25:03+00:00

I have new div I am loading into my main page called Next. The

  • 0

I have new div I am loading into my main page called “Next”. The “Next” div is a button that is on a page called Story.php I am loading it with this code.

$('.CoolBox').load('Story.php', function() 
    {
 /// The "Next div" is NOW on display but not recognized by main page that loaded it.
    });

But if I try to make the “Next” div call a function or clickable it does not work.

$("#Next").click(function() 
    {
/// Run my code. Call a function?

    });

I realize there are two options. Put the code in the page I am loading so the jQuery can see the “Next” div. I did that and it works fine when I load the “Story.php” page alone, but when I load that page into the main page it no longer works.

This same concept I need to apply to functions as well. How can I create functions that call divs that are not yet loaded on to the page?

Would I put the functions in the Story.php that can access the divs on that page or do I put the functions on the main page and somehow “register” the newly loaded divs?

I am thinking I might be able to use something like…

document.getElementById("#Next") /// but what is the full code I use?

UPDATE:
The full code can be seen here on a page called testing.php
http://beaubird.com/testing.php
Click on the first button called STORY. Then watch for a button at bottom called Next. This is also has a div name of “Next”. I want the “Next” div to be able to load more of the story and control other elements on the page.

On line #366 is where I call this code:

$('.CoolBox').load('Story.php', function() 
                {
        /// it loads this page http://www.BeauBird.com/Story.php
                // Where the Next div is contained. 
                });
        }

Any thoughts? Thanks so much!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T05:25:05+00:00Added an answer on June 15, 2026 at 5:25 am

    I wish you had showed the code which added next. But without seeing it, try this:

    var nxt = document.createElement("div");
    $(nxt).click(function(){ /* code */ };
    someNode.appendChild(nxt);
    

    Edit

    Here is an example for event delegation if you wish to go that route: http://jsfiddle.net/k3fvd/

    Specifics

    In the page linked, the delegated code

    $(".CoolBox").on("click","#Next",function(){
      /* code */
    });
    

    is working as intended. Perhaps what was unintended is that the div id="layer2" is stealing the click event because it is higher on the z-index or element list somehow. I am not entirely sure what is causing this, perhaps it is that all divs are defined as display:block; and that is somehow overwriting the position:absolute;. A simple workaround for this is to give more specificity to the position:absolute; like this:

        #layer2  {
    position: absolute important!; 
    left: 1px;
    top: 0px;
    z-index: 3;
    width: 1246px;
    height: 1031px;
    margin-left: 0px;
    margin-top: 0px;
    background-image: url(sg_jesus_media/layer2.gif);
    background-repeat: no-repeat;
    }
    

    Note that position:absolute important!; has been edited. This should allow your div id="Next" element to receive the click event.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have page loading, via AJAX a PHP page into a div. In turn,
index.php has this jquery code which loads notifications.inc.php into a div on the page
If I have this code: <div class=lists> <a href=#new_list>New list</a> </div> AND $.ajax({ url:
I have the code below loading into a jquery mobile page data-role. Two strange
On my page I have javascript that loads new content in <div id=content></div> from
I have a div that I'm loading a slider into with the .load. For
I have a script that create a new div element. Then, I want to
I have the following code in a view: <div class=wrap_select> @Html.DropDownList(dateRange, new SelectList(Model.DateRange, Value,Text),
I have new problem. My code: .method public static void Main() cil managed {
I am new to jQuery / AJAX. I have a page that uses colorbox

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.