8

如何从项目列表中过滤当前项目。例如。

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

        //! get the items that are not clicked

    }
)

$('.div')返回项目列表,并单击其中一个。如何获取未点击的项目列表。

注意:我不是在寻找将属性添加到单击的项目(或未舔的项目)并对其进行过滤的解决方案。

4

3 回答 3

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

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

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

    }
)
于 2011-03-06T08:58:59.833 回答
2

试试兄弟选择器

$(this).siblings()
于 2011-03-06T08:58:52.203 回答
0

怎么样$('.div:not(this)')

于 2011-03-06T08:58:10.870 回答