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 9009351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:10:06+00:00 2026-06-16T02:10:06+00:00

On page load I bind Event Handlers with content which is hidden on at

  • 0

On page load I bind Event Handlers with content which is hidden on at the time of page load.

If users clicks on the button, the hidden content is pulled and replaces the main content of the page, Now the event Handlers which were initially binded do not work.

HTML code on Page load

<p> Initial content of the page </p>
<button id="button"> Click Here to change content</button>
<div class="show-later" style="display: none;"> Some Hidden content </div>  

After the user clicks a button the new dom looks some thing like this

<p>
 <div>Some Hidden content</div>
</p>

After the manipulation the event handlers binded to the div element do not work any more. Please notice that the div goes into the P element after DOM Manipulation.

jQuery Code:

   $('#button').click(function(){
      var show_later = $('.show-later').html();
      $('p').html(show_later);
   });

   $(document).ready(function(){
      $('.show-later').click(function(){
       // Do something.....
      });
   });
  • 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-16T02:10:08+00:00Added an answer on June 16, 2026 at 2:10 am

    You’re not moving the <div>, you’re just taking its content (a text node) and copying that to the paragraph. Contrary to what you’ve stated in the question, the resulting DOM will actually look like this:

    <p> Some Hidden content </p>
    <button id="button"> Click Here to change content</button>
    <div class="show-later" style="display: none;"> Some Hidden content </div>
    

    The <div> is still there, it still has content, and it still has the event handler for click bound to it; but it’s also still hidden, so there’s no way you can click on it.

    I’d suggest that you actually move the <div> into the <p> element, like so:

    $('.show-later').show().appendTo('p');
    

    That will select the <div>, make it visible, and then move the element itself into the <p>.

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

Sidebar

Related Questions

I am trying to bind a click event to a button within a usercontrol
I'm supposed to create a custom event triggered on page load that adds a
In my asp.net application have one data list, page load event I have to
If I bind GridView to SqlDataSource, then the first time page will be created,
On page load I'm bootstrapping my data to my collections via this technique .
Is Page.Load the earliest point in the Page.Load life cycle to add Response.AppendHeader?
Q1) On page load is it possible with Jquery to check the file name
In my page load, am I calling ReturnStuff() once or three times? If I
I want on page load for the class of a li tag to be
I am using a simple Asp.Net button and trying to hide it on page

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.