How can I listen to the intermediate element p of div > p > a by using event delegation?

I have looked for it in hundreds of degrees before, and it is basically a two-tier div > p, but now I have more than two layers of demand. I have thought about finding the parent element of ev.target, but if the nesting is a little deeper, it will be very troublesome, and I also consider that if I look for a parent element, the parent element of span is a, and the parent element of an in front is p, so I can"t accurately monitor the event of p. What can I do to solve this problem?.

Sep.16,2021

you can give special identification to the elements you want to listen to. Then at the top level, determine whether there is that flag


you can only add classes if you don't want to find them through complex node relationships | | id then go to class, id, ah, this kind of processing
of course, other attributes can also

if you want to use event delegates, you have to consider a variety of situations:
separately judge that event.target.tagName is "DIV A SPAN", and find the values of parent elements at different levels.

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-1e9d7a4-47723.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-1e9d7a4-47723.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?