Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Elementor Loop Item link not working › Reply To: Elementor Loop Item link not working
March 11, 2025 at 7:23 pm
#53295
Keymaster
Yea, okay. I checked the event handler, it does not re-attach when the items are reloaded unfortunately. I have extracted their code to re-attach the event listener, I hope they can fix it in the future. For now, use this custom code:
add_action(
'wp_footer',
function () {
?>
<script>
jQuery(function() {
const handler = function(e) {
var wrapper = jQuery(this)
, url = wrapper.data('column-clickable');
if (url) {
if (jQuery(e.target).filter('a, a *, .no-link, .no-link *').length) {
return true;
}
if (url.match("^#elementor-action")) {
let hash = url;
hash = decodeURIComponent(hash);
if (hash.includes("elementor-action:action=popup:open") || hash.includes("elementor-action:action=lightbox")) {
if (0 === wrapper.find('#make-column-clickable-open-dynamic').length) {
wrapper.append('<a id="make-column-clickable-open-dynamic" style="display: none !important;" href="' + url + '">Open dynamic content</a>');
}
wrapper.find('#make-column-clickable-open-dynamic').click();
return true;
}
return true;
}
if (url.match("^#")) {
let hash = url;
jQuery('html, body').animate({
scrollTop: jQuery(hash).offset().top
}, 800, function() {
window.location.hash = hash;
});
return true;
}
window.open(url, wrapper.data('column-clickable-blank'));
return false;
}
}
document.querySelectorAll(".asp_main_container").forEach((el) => {
el.addEventListener("asp_search_end", (event) => {
jQuery(document).on('click', 'body:not(.elementor-editor-active) .make-column-clickable-elementor', handler);
});
});
});
</script>
<?php
},
999
);
Try adding this code via the Code Snippets plugin or to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.