Put var inside jquery :gt()

后端 未结 2 862
日久生厌
日久生厌 2021-01-12 02:17

I have a list set with display:none and some code to show item 3:

HTML:

  • item 1
  • item 2&
2条回答
  •  悲哀的现实
    2021-01-12 02:53

    You need to delimit the string with the correct quotes. Try this:

    $("li:gt(" + item + "):lt(1)").show();
    

提交回复
热议问题