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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:10:27+00:00 2026-05-15T23:10:27+00:00

I have explained the problem below this code <div id=’content’> <div id=’help’> blah blah

  • 0

I have explained the problem below this code

<div id='content'>

<div id='help'>
blah blah blah
once there lived a king named midas
blah blah blah
</div>

<script>
$(document).ready(function() {
    $('#help').click( function () {
          $('help').hide(500);
     })
})
</script>

<!-- bottom of the page after a long other content -->
</div>
<!-- end of div id= content -->

<script>
function ondelete()
{
// doing an ajax request to after deleting some items to dynamically update a list.
// the result will also have the same above div code with that help div
   document.getElementById('content').innerHTML = xmlHTTP.responseText
}
</script>

There is a content part inside a div which has ‘content’ as its id
Inside that i have a help div.
Which is display:none bydefault and if the user clicks the help button i do a

$('#help').show(500);

and when the user clicks the same help button or if the user clicks inside the help div then i do this code to hide that div $(‘#help’).hide(500)

This is working well until i do an ajax request to update the content of div id=’content’
I am overwriting the same help div with the same content. it is like i am overwriting
the entire content area except the header and the footer.

but after updating it with the response text the click event at the top of code which is inside the document.ready is not working where as onclick is working on that div

i mean is working well.
without that on click and with that above document ready code it is not working when overwritten from ajax.

From my experience javascript code or links is not working when a code with script src tags and script tags are dynamically fetched and updated using ajax.

Now i am using onclick instead of that document ready to hide and show the help div.

and above all

when there is a overwrite from ajax if you again set
$(#'help').click = .... code
this works.

like 
function ondelete()
{
   document.getElementById('content').innerHTML = xmlHTTP.responseText
   $('#help').click (function() { $('#help').hide(500); });
}

so it seems that you have to update all the attached events when you update it using ajax.

Please put your comments and suggestions to overcome this.

  • 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-15T23:10:28+00:00Added an answer on May 15, 2026 at 11:10 pm

    try using .live().

    $(document).ready(function() {
        $('#help').live('click', function () {
              $(this).hide(500);
         });
    });
    

    .live( eventType, handler )

    as of version 1.9, .live() has been deprecated.

    You then can use http://api.jquery.com/delegate/

    Attach a handler to the event for all
    elements which match the current
    selector, now or in the future.

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

Sidebar

Ask A Question

Stats

  • Questions 491k
  • Answers 491k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer First, make sure your full text index is set up… May 16, 2026 at 10:09 am
  • Editorial Team
    Editorial Team added an answer You can't create embedded resources in a Web Site Project.… May 16, 2026 at 10:09 am
  • Editorial Team
    Editorial Team added an answer Well for the most simplistic method append :port to your… May 16, 2026 at 10:09 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am using the below example code and have a problem where I can't
I am having a very specific problem in JQuery The code below is used
This is for the swing experts out there. I have spent considerable time on
Aim The aim is to a have a container DIV with a fixed height
The below is an involved problem, I've done a great amount of research, but
I need expert advice here... I have run into the strangest problem in my
I have an application that is used in image processing, and I find myself
Are there any cases where we do down casting of objects? If we do,
Here's the problem in a nutshell: <bean id=handlerFactory class=com.westfieldgrp.audit.jdklogging.cpm.CPMHandlerFactory> <property name=schemaName value=${env.audit.databaseSchema} /> <property
I have a schema here where I am trying to include/import another schema that

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.