jQuery selector - all but the first

前端 未结 8 2021
日久生厌
日久生厌 2020-12-07 01:22

I have a small jQuery selectors question, I have the following html:

<
8条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-07 01:47

    $('.member-info:not(.first)').hide();
    

    This uses the not-selector(docs) to exclude elements with the first class.

    Or if the purpose of the first class is simply to identify the first, then do this instead:

    $('.member-info').slice(1).hide();
    

    This uses the slice()(docs) method to return a set starting with the second match.

提交回复
热议问题