Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Ajax functunality doesn't work when search bar appears inside a popup › Reply To: Ajax functunality doesn't work when search bar appears inside a popup
Looks like there is some sort of an element cloning going on there. It is a very bad practice, and causes nothing but issues. It is a shame to see it is caused by Elementor.
You can try this custom code to get by it:
add_action('wp_footer', 'wp_footer_asp_try_fix_init', 9999);
function wp_footer_asp_try_fix_init() {
?>
<script>
(function($){
$('[class*=-search]').on('click', function(){
setTimeout(function(){
$('.hasAsp').removeClass('hasAsp');
$('.hasASP').removeClass('hasASP');
ASP.fixClones();
ASP.initialize();
}, 500);
});
})(jQuery);
</script>
<?php
}
Try adding this code 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.
However please keep in mind, that this may not work in all cases, or at all, as the cause of this issue not generated by a bug in our code. Simply the element clone mechanism in javascript is a very nasty solution, and will cause issues with javascript handlers.