Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Refreshing Live Search Results not working when Clicking "X" › Reply To: Refreshing Live Search Results not working when Clicking "X"
March 5, 2021 at 10:44 am
#32023
Keymaster
Hi,
It is kind of intentional (so it only clears the prhase), as it is not completely possible to reset the elementor widget state to it’s original form. There is however a custom code I can suggest, that will trigger an empty search when clicking the close button.
Try adding this custom code to the functions.php in your theme/child theme directory. Before editing, please make sure to have a full site back-up just in case!
add_action('wp_footer', 'asp_trigger_search_on_close');
function asp_trigger_search_on_close() {
?>
<script>
jQuery(function($){
$('.proclose svg').on('click touchend', function(e){
var $e = $(this).closest('.asp_w');
setTimeout(function(){
ASP.api($e.data('id'), $e.data('instance'), 'searchFor');
}, 250);
});
});
</script>
<?php
}