Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Trouble resetting the search › Reply To: Trouble resetting the search
March 4, 2021 at 3:19 pm
#31995
Keymaster
Hi,
That button is only to clear the search phrase from the input field. However I might be able to suggest a custom code.
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
}