jQuery prevUntil() include start selector and end selector

前端 未结 1 390
误落风尘
误落风尘 2021-02-09 15:37

I would like to select the start and end selector for the prevUntil() or nextUntil() jQuery selector methods. If I implement these methods now, it grabs everything between the t

相关标签:
1条回答
  • 2021-02-09 16:21

    Take a look at the .addBack method to add the results of the previous selector to the current matches. Combining that with the .prev method seems to do the trick:

    $('p').prevUntil('h1').addBack().prev('h1').addBack();
    
    0 讨论(0)
提交回复
热议问题