I'm trying to add the placeholder attribute to all textfields across my website, but I'm having no luck.
I've created a module that overrides hook_form_alter
function mymodule_form_alter(&$form, &$form_state, $form_id)
{
foreach ($form as $key => $value) {
if ("textfield" == $value["#type"]){
$value['#attributes']["placeholder"] = t($value["#title"]);
}
}
}
I should tell you that I'm also using the webform module.