title: get each child('id') into array or string
body: <p>I need to create a comma separated value for a hidden input created from a series of div id's</p>
  
  <pre><code>&lt;div id="main"&gt;
  &lt;div id="A"&gt;&lt;/div&gt;
  &lt;div id="B"&gt;&lt;/div&gt;
  &lt;div id="C"&gt;&lt;/div&gt;
  &lt;/div&gt;
  
  &lt;input type="hidden" id="children"/&gt;
  </code></pre>
  
  <p>I want to use jquery but having trouble with the function </p>
  
  <pre><code>    function update_input(main){
          var array = new Array();
  
             $('#'+main).children('id').each(function(){
                   array.push($(this).attr('div'));  
             });         
  
          input_value = array.toString();
          $('#children').val(input_value);
      }
  </code></pre>
  
  <p>This is not right</p>