Finding Dom Node Index for elements of a certain class

后端 未结 2 589
旧时难觅i
旧时难觅i 2021-01-23 01:29

Hi I have a series of tags with different classes. When a span is clicked I want to return the index of the class of spans. So not the index of the spans themselves.

He

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-23 02:20

    Try this:

    var index = $(this).parent().find($(this)).index();
    

提交回复
热议问题