This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Search close button fix

#34283
Ernest MarcinkoErnest Marcinko
Keymaster

Hi!

I see you are using the elementor posts widget. For that case the close button intentionally does not clear the container, it only clears the search phrase.

There might be however a way to do it via a minor custom code snippet.

add_action('wp_footer', 'wp_footer_asp_try_close', 9999);
function wp_footer_asp_try_close() {
	?>
	<script>
	(function($){
		$('.proclose').on('click mouseup touchend', function(e){
			$('.asp_es_4 .elementor-posts-container').html('');
		});
	})(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.