Not able to delete list which dynamically created with jquery
<p>I have two html here. The first one is dynamically generated by php and second one is just html to test.</p>

<p>I also have the following jquery. </p>

<p>When I click a cross with class delete in the second ones(plain html), it works nicely. However when I click a cross in the first ones, it does not work.
It redirect me to the home page with # at the end.</p>

<p>I am hoping someone point out what I am doing wrong.</p>

<p>Thank in advance.</p>

<p>HTML</p>

<pre><code>First part (dyanmicall generated)
&lt;ul style="display: block;" id="message"&gt;
&lt;li class="41"&gt;
&lt;span class="user"&gt;&lt;strong&gt;shin&lt;/strong&gt;&lt;/span&gt;
&lt;span class="msg"&gt;  delete this as well&lt;/span&gt;
&lt;span class="date"&gt;2010-01-15 07:47:31&lt;/span&gt;
&lt;a href="#" id="41" class="delete"&gt;x&lt;/a&gt;
    &lt;div class="clear"&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li class="40"&gt;
&lt;span class="user"&gt;&lt;strong&gt;shin&lt;/strong&gt;&lt;/span&gt;

&lt;span class="msg"&gt;  delete me as well&lt;/span&gt;
&lt;span class="date"&gt;2010-01-14 16:01:44&lt;/span&gt;
&lt;a href="#" id="40" class="delete"&gt;x&lt;/a&gt;
    &lt;div class="clear"&gt;&lt;/div&gt;&lt;/li&gt;
...
...&lt;/ul&gt;


Second part which is plain html
    &lt;ul id="another"&gt;
    &lt;li&gt;&lt;a href="#"&gt;you can't delete me&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#" class="delete"&gt;delete this&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#" class="delete"&gt;delete this&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
</code></pre>

<p>Here is jquery</p>

<pre><code>$(".delete").click(function(event) {
    event.preventDefault();


loading.fadeIn();
var commentContainer = $(this).parent();
var id = $(this).attr("id");
// var string = 'id='+ id ;

$.ajax({
   type: "POST",
   url: "index.php/admin/messages/changestatus/"+id,
   // data: string,
   cache: false,
   success: function(){
    commentContainer.slideUp('slow', function() {$(this).remove();});
    loading.fadeOut();
  }

 });


return false;
    });
</code></pre>

<p>I am using CodeIgniter by the way.</p>
