jquery click event does not work when content is overwritten using ajax
<p>I have explained the problem below this code</p>

<pre><code>&lt;div id='content'&gt;

&lt;div id='help'&gt;
blah blah blah
once there lived a king named midas
blah blah blah
&lt;/div&gt;

&lt;script&gt;
$(document).ready(function() {
    $('#help').click( function () {
          $('help').hide(500);
     })
})
&lt;/script&gt;

&lt;!-- bottom of the page after a long other content --&gt;
&lt;/div&gt;
&lt;!-- end of div id= content --&gt;

&lt;script&gt;
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
}
&lt;/script&gt;
</code></pre>

<p>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 </p>

<pre><code>$('#help').show(500);
</code></pre>

<p>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)</p>

<p>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.</p>

<p>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</p>

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

<p>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.</p>

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

<p>and above all</p>

<pre><code>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); });
}
</code></pre>

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

<p>Please put your comments and suggestions to overcome this.</p>
