Search code examples
cssdrupal-7search-form

How to make the search form without the search button?


This question is related to CSS/HTML and drupal web development. I am developing website using Drupal 7. And by default Drupal provides the Search form (as shown in image) with input text box and button next to it. How can I remove the that search button and make it like just text input box, for example you can see the search form of stackoverflow. So by this there is no need for clicking the button, just write text and enter. Thanks

Drupal default search form

Note: Drupal is the content management system. And why I am asking this question here as solution is related to CSS/HTML.


Solution

  • If you want to hide submit button but keep the auto submit on enter possibility you can just hide the submit button with css:

    #edit-custom-search-blocks { //replace this selector with ID of your submit button
          position: absolute;
          top: -999px;
          left: -999px;
          width: 0px;
          height: 0px;
    }
    

    You can place it in your default CSS file. (then clear the Drupal cache)