How to dynamically make a field visible? I'm trying to render a field based on a select value. However I couldn't succeed for now, so here is what I tried:

I created a content type with a select field (field_type)

var_dump($form['field_type']['und']['#options']); 


gives

array (size=5)
  '_none' =&gt; string '- Select a value -' (length=18)
  'externe' =&gt; string 'externe' (length=7)
  'interne' =&gt; string 'interne' (length=7)
  'carroussel' =&gt; string 'carroussel' (length=10)
  'vitrine' =&gt; string 'vitrine' (length=7)


I noticed 'und' by printing my field and reading the first comment on this page 
Drupal process states 7.x

and my field that should be visible (or not) 

$form['field_target_text'] = array(
        '#type' =&gt; 'textfield',
        '#default_value' =&gt; '',
        '#states' =&gt; array(
          'visible' =&gt; array(
            'input[name="field_type[und]"' =&gt; array('value'=&gt;'interne')
          ),
        ),
      );


I tried to replace input with select, to remove [und] but nothing did the job until I replaced the field like this 

$form['field_type'] = [
        '#type' =&gt; 'select',
        '#title' =&gt; ('TYPE TPE'),
        '#description' =&gt; ('TEST.'),
        '#options' =&gt; $form['field_type']['und']['#options']
      ];


Seems like he doesn't like my field not having an ['#options'] but ['und']['#options']. However by doing so, when I save my node, the field_type is empty.

Any help or advise would be appreciated.
You miss ] in the selector ':input[name="field_type[und]"' code test with the following it will work.

':input[name="field_type[und]"]' =&gt; ['value' =&gt; 'interne'],


Update:
The state work with any valid JQuery selector, so if you looking to target it with select selector instead of :input you can use this:

 'select[name="field_type[und]"]' =&gt; ['value' =&gt; 'interne'],