This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: dev question

#35547
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

Please note that this is not a plugin related issue, but a custom development questions, but I will try to give the best possible answer.

Can you please add a link, where I can see the search bar? The solution highly depends on how that icon is exactly placed and implemented to the results.

One issue I am seeing with the code, that dynamic jQuery event handlers should be attached to the closest parent of the changing element. In the code on the screenshot it is attached to the document, however attaching it to the results container would work much better:

jQuery('.asp_r').on('click', '.fa-heart', function(e){
	e.preventDefault();
	e.stopPropagation();
	e.stopImmediatePropagation();
	console.log('click');
});

The bubbling events need to be stopped from propagating as well, as you can see from the above code – otherwise it will trigger the click event.