:nth-of-type() in jQuery / Sizzle?

后端 未结 3 1491
旧时难觅i
旧时难觅i 2020-11-30 08:46

It surprised me that Sizzle (the selector engine jQuery uses) comes with a built-in :nth-child() selector, but lacks an :nth-of-type() selector.

3条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-30 09:40

    the jQuery plugin moreSelectors has support for nth-of-type (and many other selectors). I suggest either using that, or simply implement a simple plugin that only implements the exact selectors you need. You should be able to copy-paste code from there.

    Happy hacking!

提交回复
热议问题