on .bind('click') it is not deleting the first div

Posted by Jean on Stack Overflow See other posts from Stack Overflow or by Jean
Published on 2010-06-15T08:11:06Z Indexed on 2010/06/15 8:12 UTC
Read the original article Hit count: 155

Filed under:
|
|

Hello,

When I click on a particular div, that div should fade out, simple, but when I click on one of the divs it deletes the div on top of the stack. ie., when I click #sel6 it removes sel5

html code

<div id="selc" class="selc" style="position:absolute; left:15px; top:200px; width:260px;">

<div id="sel5" class="sel">something</div>
<div id="sel6" class="sel">something</div>
<div id="sel7" class="sel">something</div>

</div

>

jquery code sel_id, sel_1 are variables

$('.selc').bind('click',function(){
                                                                                                                                                                    var sel_id = $('.sel').attr('id');
                                                                alert(sel_id);

                                                                $('#'+sel_id).fadeOut('slow');
                                                                $('#'+sel_id).remove();
                                                                $('.search_box').append(sel_1);
});

Thanks Jean

© Stack Overflow or respective owner

Related posts about php

Related posts about JavaScript