title: using if statements with input values jquery
body: <p>I have a short script that calculates a number by multiplying <code>input</code> values. That script works fine but now I want to add if statements. For example:</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;label&gt;Width&lt;/label&gt;&lt;input type="text" id="width" /&gt;
  &lt;br&gt;
  &lt;label&gt;Length&lt;/label&gt;&lt;input type="text" id="length" /&gt;
  &lt;br&gt;
  &lt;label&gt;Total&lt;/label&gt;&lt;input type="text" id="total"/&gt;
  </code></pre>
  
  <p>JavaScript:</p>
  
  <pre><code>var w = $('#width').val();
  var l = $('#length').val();
  var total1 = 2;
  var total2 = 3;    
  if((w * l) &gt; 5){
      total = total1 * (w + l);
      parseInt($('#total').val('total'));
  }
  if((w * l) &lt; 5){
      totalnew = total2 * (w + l);
      parseInt($('#total').val(totalnew));
  }
  </code></pre>
  
  <p>So if <code>(#width x #length) &gt; 5</code>, the value of <code>(#width x #length)</code> would be multiplied by a certain number, in this case "2". </p>
  
  <p><a href="http://jsfiddle.net/sKyKv/" rel="nofollow">Tried to figure it out on jsfiddle</a>.</p>
  
  <p>Here is the code that works without the if statements: <a href="http://jsfiddle.net/e45SJ/" rel="nofollow">http://jsfiddle.net/e45SJ/</a></p>
  
  <p><strong>How can I implement what I am looking to achieve with the if statements with the code I already have?</strong></p>
  
  <p><strong>EDIT: How can I add more than one if statement? I tried this:</strong> <a href="http://jsfiddle.net/m2LxV/2/" rel="nofollow">http://jsfiddle.net/m2LxV/2/</a></p>