you should use classes instead of id's, since it's invalid html to have more elements with the same id on the same page.. the way you're doing it binds the click event to only the first element found on page (since the id must be unique)..

change the id="trash" to class="trash" and $('#trash') to $('a.trash') and it should work..

dennis.

G[N]Urpreet Singh wrote:
Hi guys,
I cannot "remove" the parent of an element in IE6. The behavior in IE6 is that only the first of the parents is getting removed and then it stops working.

Here is the code...

<script type="text/javascript" src="libs/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $("#trash").click(
        function()
        {
            $(this).parent().remove();
        }
    );
});
</script>
<body>
<div id="container">
    <div>This is div 1 <span id="trash">Del</span></div>
    <div>This is div 2 <span id="trash">Del</span></div>
    <div>This is div 3 <span id="trash">Del</span></div>
    <div>This is div 4 <span id="trash">Del</span></div>
</div>



Any ideas??
--
Gurpreet Singh

Reply via email to