jhon de jhon de - 1 year ago 79
jQuery Question

How do i trigger click on scr image under href

I want to trigger click on estrela_16.gif


<img src="https://www.bux.com/imagens/estrela_16.gif" border="0" height="16" width="16">

Answer Source

You can simply use the jQuery selector to achieve that, like this:

$("img[src*='estrela_16.gif']").on('click', function() {
 // Do something...

In case you want to trigger the click event, do this:


or more direct:


More information can be found here https://api.jquery.com/attribute-contains-selector/, and here http://api.jquery.com/trigger/

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download