Alter hook_field_formatter_view? What is the best way to alter field output? I found "hook_field_formatter_view" but seems nothing like "hook_field_formatter_view_alter" exists. In my case I have address fields (Addressfield module) which used in "Shipping" and "Billing" panes on DrupalCommerce's checkout page. I want to add some js to these fields, preferable using Drupal's Form API "#attached"
You may want to try to alter it with a preprocess function:

function example_preprocess_field(&amp;$variables) {  
  $field_name = $variables['element']['#field_name'];  
  if ($field_name == 'field_example_field') {
    // Your code here.
  }
}


I ran a test to modify $variables['element']['#attached']['js'] but Drupal didn't recognize the changes to the element. Not sure why. So, you may have to use drupal_add_js.