1👍
✅
This is impossible(almost)! Pseudo-elements are not part of the DOM. You can’t bind any events directly to them.
However you can do a trick: add some child element without any content and bind click event to that element. Use :after
just to show your close button.
Source:stackexchange.com