title: Jquery Selector With Variable Not Working
body: <p>So i am trying to get a value of a field using jquery and a variable but for some reason I can't get it to work:</p>
  
  <pre><code>    var col = field1;
      var val = $('select[name='+col+']').val();
  </code></pre>
  
  <p>For some reason this code is not working and I am not sure why.  But when I remove the variable it works fine.</p>
  
  <pre><code>    var val = $('select[name=field1]').val();
  </code></pre>
  
  <p>This works fine.  How do i pass a variable value into this equation?  Thank you for any help.</p>