I want to add a class to the link in my delete content page, currently the 'delete' button itself is styled because it falls under the styling for input[type=submit] in my CSS, but the 'cancel' button is just regular text.

I also have the webform edit page with links for 'clone', 'edit' and 'delete' how would I go about adding classes to these as well?

I don't want to just add a class for all links because thats overkill in my scenario


1 Answer 1


Using the FAPI in a hook_form_alter() function:

$form['buttons']['delete']['#attributes']['class'] = 'my-class';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.