Get siblings between 2 elements

后端 未结 4 462
旧时难觅i
旧时难觅i 2021-01-11 17:01

How can I get the elements between 2 other elements?

Like if I had:

4条回答
  •  忘掉有多难
    2021-01-11 17:30

    You could also try the following:

    var selected_elems = $("div").slice(2,6);
    

    slice(): reduce the set of matched elements to a subset specified by a range of indices.

    Documentation: http://api.jquery.com/slice/

提交回复
热议问题