Home ›
HTML5 placeholder via form alterHTML5 placeholder via form alter
Submitted by Benjamin Melançon on February 2, 2011 - 12:34pm
In a module OR a theme:
<?php
/**
* Use the HTML5 placeholder attribute to add help text to the search box.
*/
function PROJECTNAME_form_search_block_form_alter(&$form, &$form_state) {
$form['search_block_form']['#attributes']['placeholder'] = t('enter search terms');
}
?>
(via http://adaptivethemes.com/html5-placeholder-text-for-your-drupal-7-search-field#comment-1509 )
Comments
Post new comment