Placeholder change not applied to form fields
I have written code to change the placeholder for a form using hook form_alter()
, but it’s not working. Is there any other way to change the placeholder for a form?
My code :
function modulename_form_alter(&$form, &$form_state, $form_id){ if ($form_id == 'my_form_id') { $form[profile]['field_name'][und][0]['value']['#attributes']['placeholder'] = t('placeholder name'); } }
This article was republished from its original source.
Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.