The Following code adds an image before header tag.
How can add javascript or jquery code for handling some task when the image added before the header was clicked.
Pseudo elements such as :before and :after in CSS aren't part of the DOM and can't be altered or interacted with javascript. You would need to add the image to a 'real' element and attach the event handlers to that if you want it to be interacted with.