title: Jquery add option to all select elements with 2D names
body: <p>I am attempting to dynamically add an option value to ALL select fields with a certain multidimensional name, but I just can't seem to figure it out :(</p>
  
  <p><strong>Here is the HTML :</strong></p>
  
  <pre><code>&lt;input type="text" name="computer['id'][]" onBlur="load_comp_select();"&gt;
  </code></pre>
  
  <p>Dynamically added service input field.  There can be over 10 indexes.</p>
  
  <pre><code>&lt;select name="service['comp_id'][]"&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p><strong>Here is the JS :</strong> </p>
  
  <pre><code>function load_comp_select(){
      var computers = $("input[name^='computer[\\'id\\']']").serializeArray();
      $.each(computers, function(i, field){
          console.log(field.value);
          $.each($("input[name^='service[\\'comp_id\\'][]']"), function(key, value){
              console.log("service : " + key);
              $("input[name^='service[\\'comp_id\\']']").eq(key).append($('&lt;option/&gt;', {
                                                              value: field.value,
                                                              text : field.value
                                                              }));
          });
      });
  }
  </code></pre>
  
  <p>To sum up what I am attempting to do...  When I type in a computer ID in any of the computer['id'][] fields, the value of that field with be added as an option to all selects with the name service['comp_id'].  Any help is appreciated!</p>
  
  <p><a href="https://jsfiddle.net/xqvsabzq/3/" rel="nofollow">JSFiddle</a></p>