Edit

JavaScript Template Coding Drupal Show field when a different selection is made on the same form

function HOOK_form_alter( &$form, &$form_state, $form_id ){

    if( $form_id == "user_register_form" || $form_id == "user_profile_form" ) {


        // Shows OTHER text field when 'Other' is selected as their specialty

        $form["field_specialty_other"]["#states"] = array(
            "visible" => array(
                ':input[name="field_specialty[und]"]' => array("value"=>"Other"),
            )
        );


    }

}