Event delegate binding A ul, how to know which li is clicked in the ul

the content of li is the same. Is there any easier way to get the index of li

?
Sep.25,2021

  1. you can first get event.target
  2. I think we can directly refer to the .index () method of jQuery source code .
  3. if you use jQ, you can use $(this). Index () directly
  4. .

when rendering, just write it in the attr of li. It has to be processed in a loop when you get it, which is very inefficient.
most li renderings are cyclical and static. Forget it.


sibling framework can help you have API, such as the index () method mentioned above.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3c311-2c2e7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3c311-2c2e7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?