title: Javascript "if" statement issues
body: <p>So I have a function that is triggered when something on the check box field gets select. When an option is selected the script needs to go back, and see if a drop down field has a certain value. if that field has that certain value, then it needs to run the code that's inside the if statement. if not then it needs to skip that code and go to the next drop down.</p>
  
  <p>The code is all working exactly how I need it to be from start to finish. The only problem is the if statements referencing the drop down don't work. no matter what value i select in the drop down field, the script runs.</p>
  
  <p>So var carOp1-8 are the drop down fields. If the drop down field has selected "simplex" then I need the code inside it to run. Problem I am having is the code is running no matter what I select for the drop down field every time. is there something wrong with the sentex of the ' var carOp1... ' if statements?</p>
  
  <p>I have also tried it with if (name == "this") </p>
  
  <p>Here is the jsfiddle link so you can get an idea of what I am talking about.
   <a href="http://jsfiddle.net/upcQ8/" rel="nofollow">http://jsfiddle.net/upcQ8/</a> 
  (on my form the page is automatically loaded when I hit the next button, I didn't know how to make that work on JSfiddle.</p>
  
  <p>Here is the javascript I am using...</p>
  
  <pre><code>// Additional Options
  $('input[name="item_meta[2002][]"]').change(function(){
  
  var carOp1 = $("select[name='item_meta[2095]']").val();
  var carOp2 = $("select[name='item_meta[399]']").val();
  var carOp3 = $("select[name='item_meta[405]']").val();
  var carOp4 = $("select[name='item_meta[402]']").val();
  var carOp5 = $("select[name='item_meta[404]']").val();
  var carOp6 = $("select[name='item_meta[403]']").val();
  var carOp7 = $("select[name='item_meta[401]']").val();
  var carOp8 = $("select[name='item_meta[400]']").val();
  
  var simOpn1 = 0;
  
  // Car 1 Simplex
  if (carOp1 ="Simplex") {
      var opn1 = $("#field_open1").val();
      if (Number(opn1) &gt;= Number(simOpn1)) {
          var simOpn1 = $("#field_open1").val();
  }} 
  // Car 2 Simplex
  if (carOp2 ="Simplex") {
      var opn1 = $("#field_open2").val();
      if (Number(opn1) &gt;= Number(simOpn1)) {
          var simOpn1 = $("#field_open2").val();
  }} 
  // Car 3 Simplex
  if (carOp3 ="Simplex") {
      var opn1 = $("#field_open3").val();
      if (Number(opn1) &gt;= Number(simOpn1)) {
          var simOpn1 = $("#field_open3").val();
  }} 
  // Car 4 Simplex
  if (carOp4 ="Simplex") {
      var opn1 = $("#field_open4").val();
      if (Number(opn1) &gt;= Number(simOpn1)) {
          var simOpn1 = $("#field_open4").val();
  }} 
  // Car 5 Simplex
  if (carOp5 ="Simplex") {
      var opn1 = $("#field_open5").val();
      if (Number(opn1) &gt;= Number(simOpn1)) {
          var simOpn1 = $("#field_open5").val();
  }} 
  // Car 6 Simplex
  if (carOp6 ="Simplex") {
      var opn1 = $("#field_open6").val();
      if (Number(opn1) &gt;= Number(simOpn1)) {
          var simOpn1 = $("#field_open6").val();
  }} 
  // Car 7 Simplex
  if (carOp7 ="Simplex") {
      var opn1 = $("#field_open7").val();
      if (Number(opn1) &gt;= Number(simOpn1)) {
          var simOpn1 = $("#field_open7").val();
  }} 
  // Car 8 Simplex
  if (carOp8 ="Simplex") {
      var opn1 = $("#field_open8").val();
      if (Number(opn1) &gt;= Number(simOpn1)) {
          var simOpn1 = $("#field_open8").val();
  }} 
  
  // Simplex 1 Car Call Security
  if ($("input[name='item_meta[2002][]']:checked").val()=="Car Call Security"){   
      var carSec1 = simOpn1;
  
  } else var carSec1 = 0;
  
      {$("#field_s1calc").val(carSec1).change();} 
  
  }); 
  </code></pre>