How to add css class to these form fields? I wan to be able to add certain css class to all the text fields in my content edit forms. here is a picture of what i can see using Devel:


Those arrays under the "Und" are for the fields I want to add the class. I have tried to do this with the following: 

function iclub_form_article_node_form_alter (&amp;$form, &amp;$form_state) {
dpm($form);
$form['field_body']['und']['0']['#attributes']['class'][] ='addRecactor';

foreach ($form['field_paragraph']['und'] as $i) {
    if (is_numeric($i)) {
        echo $i .'&lt;/br&gt;';
        $form['field_paragraph']['und'][$i]['field_myparagraph']['und']['0']['#attributes']['class'][] ='addRecactor';
        foreach ($form['field_paragraph']['und'][$i]['field_myparagraph']['und'] as $y) {
            if (is_numeric($y)){
                $form['field_paragraph']['und'][$i]['field_myparagraph']['und'][$y]['#attributes']['class'][] ='addRecactor';
            }
        }   
    }           
}


but this does not work for all the fields and I think it is not the solution as it is not robust.

How may I be able to add the class to these fields?
You should write a statement that first check the form element type then add class attrubutes to it,
something like 
//in form_alter

foreach($form as $form_elem){
if($form-elem['#type']=='textfield'){
    $form[$form_elem]['#attributes']['class'][] = 'myclass';
   }
}


(this is not the exact solution,I just want give you idea)

another way is using hook_preprocess_field 

and the final and easy way is using js to add class, because drupal set default class for his textfields,you just need one line jquery code to add you 

   $('.form-text').addClass('myclass');


if you don't want this js not load in all page, I suggest you add your js with drupal_add_js conditionally in hook_form_alter, it means that  

    //in hook_form_alter
     $des_forms=array('node_add_page','node_add_prodcut');
    if(in_array($from_id,$des_forms)){
    drupal_add_js('your js'); //you also add it inline,but I suggest you put it in js and add it as file
}


again I tell you because I have no time in this moment I just suggest you some solution idea, I hope could help you