How to get a specific jQuery item from a list of items?

后端 未结 5 1175
难免孤独
难免孤独 2021-01-07 23:23

I have this:

  • first
  • second
  • third
  • fourth
5条回答
  •  北海茫月
    2021-01-08 00:20

    you can use nth-child

    $("ul li:nth-child(2)") //this will select second child because it is 1 based index
    

    here is a fiddle http://jsfiddle.net/xyyWh/

提交回复
热议问题