title: jQuery matrix input value
body: <p>I have an inputs where I want to put some value like [ [2, 4, 2] ] (to make a multiply matrix) . Now I want to read the value but not as a "[ [2, 4, 2] ]". Is there any way to do this?</p>
  
  <pre><code>&lt;body&gt;
      &lt;div id="main"&gt;
          &lt;form&gt;
              &lt;input type="text" id="first"/&gt;
              &lt;label  for="first"&gt;example [ [2, 4, 2] ]&lt;/label&gt;
              &lt;input type="text" id="second"/&gt;
              &lt;select id="select"&gt;
                  &lt;option value="add"&gt;Add&lt;/option&gt;
              &lt;/select&gt;
              &lt;textarea&gt;&lt;/textarea&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  
  &lt;script type="text/javascript"&gt;
  $( document ).ready(function() {
      var select = $('#select');
  
       function multiplyMatrix(m1, m2) {
          var result = [];
          for(var j = 0; j &lt; m2.length; j++) {
              result[j] = [];
              for(var k = 0; k &lt; m1[0].length; k++) {
                  var sum = 0;
                  for(var i = 0; i &lt; m1.length; i++) {
                      sum += m1[i][k] * m2[j][i];
                  }
                  result[j].push(sum);
              }
          }
          return result;
      }
      select.change(function(){
          var 
              m1 = $('#first').val(),
              m2 = $('#second').val();
              multiplyMatrix(m1, m2);
              console.log(multiplyMatrix(m1, m2));
      });
  
  });
  &lt;/script&gt;
  </code></pre>