Trigger event clicking on html field

Hi!

I have a html field where I load pictures. I need an event to trigger when I click on the image. Found a solution here that works with a field but no with my use case:

Any ideas on what can be happening?

Thanks!

I found a workaround using this

frappe.ui.form.on(cur_frm.doctype, {
    	onload_post_render: function(frm) {
		    frm.page.wrapper.find("img").on("click", function(evt){
			    frm.set_value("MY_FIELD", 1); 
                refresh_field("MY FIELD");
		    })
	    }
});
2 Likes