Tagged: ,

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1050737

    I’ve placed a search bar in the header area of the site and have disabled the ajax results using css. All is working well. However, whenever I search for something using the search box, the search term remains in the form field instead of the ‘Search’ placeholder text.

    To clarify, on page load, the search box has the placeholder text ‘Search’. I search for the term ‘sofa’ and hit return. Search result page displays correctly, but now the search box in the top of the page says ‘sofa’ instead of ‘Search’. It’s also live text, not placeholder.

    Shouldn’t this be clearing out on page load?

    #1050784

    Hey David,

    Thank you for contacting us.

    Would you mind providing a precise link to the page, showing the elements in question? We need to be able to inspect them in order to help :)

    Best regards,
    Vinay

    #1051027

    Attaching site url in private content. Thanks for the help.

    #1051445

    Checking in. Were you able to recreate the issue with the info provided?

    #1051771

    Hi,

    Please try adding this at the very end of your themes/child theme’s functions.php file:

    
    // Reset search field
    function searchPlaceholder(){
        ?>
        <script>    	
            jQuery(document).ready(function() {           	           	
            	jQuery('#header #searchform').find("input[type=text]").val(" ");
            });
        </script>
        <?php
    }
    add_action('wp_footer', 'searchPlaceholder');
    
    // End function
    

    For more information about adding custom script please check this link.

    Best regards,
    Vinay

    #1051848

    This works for me.

    Many thanks for the help.

    #1051859

    Hi,

    I’m glad this was resolved. If you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Clearing Search Form field back to placeholder after Search’ is closed to new replies.