Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Filter other than this

How to filter the current item from the list of items. Eg.

$('.div').click(
    function (){
        $(this).val('this is clicked');

        //! get the items that are not clicked

    }
)

$('.div') returns a list of items, and one of them is clicked. How to get the list of item, that are not clicked.

Note: I am not looking the solution that adds attribute to the clicked item (or unlicked item) and filters it.

like image 523
Santosh Linkha Avatar asked Mar 06 '11 08:03

Santosh Linkha


2 Answers

$('.div').click(
    function (){

        $(this).val('this is clicked');

        var others = $(".div").not($(this));

    }
)
like image 186
stef Avatar answered Sep 28 '22 00:09

stef


Try the siblings selector:

$(this).siblings()
like image 30
Andomar Avatar answered Sep 28 '22 01:09

Andomar