title: Jquery, split select value to two strings and assign to two inputs using arrays
body: <p>I need to split the value of my html select option and pass the split results into two separate input fields. I tried to code this before but ended up with a not so DRY result.</p>
  <blockquote>
  <p>Could someone help me understand how to pass an array's value to each
  element in another array? <em>This was even confusing to write. :(</em></p>
  </blockquote>
  <p>This is what I have so far;</p>
  <pre><code>$(document).ready(function() {
  
    $('#media-size').change(function() {
      var selectValue = $(this).val();
      var arr = selectValue.split(&quot;x&quot;);
      var valOne = arr[0];
      var valTwo = arr[1];
  
        $('.media-value').each(function() {
          $(this).val(arr);
      });
    });
  });
  </code></pre>
  <p>Here's a link to the fiddle I've been working on; <a href="https://jsfiddle.net/Beaniie/2txomfhr/31/" rel="nofollow noreferrer">Click Here</a></p>
  <p>Any guidance would be much appreciated.</p>
  <p>Regards, -B.</p>
  <p>P.s.</p>
  <p>To clarify, before this question is marked as a duplicate. I'm looking for a Jquery answer, not a java answer which is all I seem to be able to find on the subject.</p>