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

Search close button fix

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #34273
    tharindu63tharindu63
    Participant

    ***

    When we search something in the search in the hero section, it displays the results. But when we click the close button appearing inside the search, it still shows the previous results. Can we fix this?

    #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.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘Search close button fix’ is closed to new replies.