Changing the Search button text in Drupal Gardens

In another article, we added some default text to the Search field on a Drupal website. We changed the text to Spanish, but the website's Search button is still in English. To have the Search button match the language of the Search field, you can use jQuery. For information about adding JavaScript to your Drupal Gardens website, see JavaScript libraries. If you are a regular Drupal 7 user, you can download the Javascript libraries module.

Here's how you can add the code to the head of your website.

  1. Save this code in a text file and name it submit-button-change.txt. This script will assign a new text value to the button with an id of edit-submit.
    jQuery(document).ready(function() {         jQuery('#sidebar-a #edit-submit').val('Buscar'); });

    You may need to change the region from #sidebar to something else, depending on what region your search box is in.

  2. Go to Configuration > System > JavaScript libraries > Custom.
  3. Click Add JavaScript.
  4. In the Source menu, select File.
  5. Upload the file you previously saved.
  6. In the Region on page menu, select Head (or whatever region your search box is in).
  7. Click Save.

The Search button now displays the word Buscar.

submit-button-jquery.png

Contact supportStill need assistance? Contact Acquia Support