Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Ajax Search with Elementor Pro results displaying twice › Reply To: Ajax Search with Elementor Pro results displaying twice
July 18, 2023 at 2:17 pm
#44720
Keymaster
Sure! Can you try maybe this variation:
add_action('wp_footer', 'asp_custom_footer_script', 99999);
function asp_custom_footer_script() {
?>
<script>
window.addEventListener("load", (event) => {
(function($){
$('.asp_m').on('asp_elementor_results', function(){
let id = $(this).data('id');
let seen = [];
$('.asp_es_' + id + ' .elementor-post').each(function(){
if ( seen.includes(this.className) ) {
$(this).remove();
} else {
seen.push(this.className);
}
});
});
}(WPD.dom));
});
</script>
<?php
}