I'm trying to add an additional class to a form element using the following code:
/**
* Implements hook_form_FORM_ID_alter().
*/
function grant_opportunity_form_grant_opportunity_node_form_alter(&$form, &$form_state, $form_id) {
$form['grant_opportunity_end_date']['#attributes']['class'][] = 'datepicker';
}
But the additional class is not being added. Am I doing this incorrectly? This is a very simple thing I'm trying to do, so I'd prefer not to go through the trouble of overriding the theme, or anything more involved like that.
EDIT: To be clear, a class is being added to the parent div of this element, but not the element itself.