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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:21:50+00:00 2026-05-27T15:21:50+00:00

Not sure if this is a bug or I am not suppose be doing

  • 0

Not sure if this is a bug or I am not suppose be doing this.

I have a page with sidebars that loads the main body dynamically.

For page1, I have a callback for an element #id1, which works on initial load.

After the user navigates to page2, the main content will get replaced by contents of page2, which also has an element with #id1, they serve the same purpose. events are initialized there as well.

The problem is that everything on page 2 would work except the event associated with #id1.

If navigating back to page 1, #id1 wouldn’t work as well.

After looking at the console, I found that when calling $("#id1") sometimes give me the initial load element (not destroyed?), which is probably the reason.

The ajax load simply uses:

$.get(path, function(data) {$('#main').html(data)});

Any idea what’s going on here?

If the old elements are not ‘properly destroyed in jquery’, what is suppose to be done here.

  • 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-05-27T15:21:51+00:00Added an answer on May 27, 2026 at 3:21 pm

    While it’s not clear exactly what you’re binding, the solution is to use (depending on your jQuery version) live() or on() to ensure that you bind to elements that aren’t in the DOM at execution time.

    jQuery 1.7+: on()

    $(document).on('click', '.selector', function() { ... });
    

    jQuery <1.7: live()

    $('.selector').live('click', function() { ... });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not sure that this is a bug since after searching I can't find
I have an IE bug that I'm not sure how to fix. Using jQuery
Not sure if this is a bug but it's not doing what I expect.
I am not sure whether this is a bug or if I have totally
I'm not sure if this is a bug or just some crazy new thing
I am not sure if this is a bug - but in this example
I am not sure if this is a bug or if I'm just missing
Not sure if this is intended behavior or a bug or a wrong function
This is not a real bug BUT for sure it is not what you
I'm sure it is meant to be like this (e.g. not a bug or

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.