title: Why won't my CoffeeScript if/else statement work?
body: <p>I've been trying to update a total price when someone changes the select option. Here is the select element I'm using:</p>
  
  <pre><code>&lt;select id="payment_talks_purchased" name="payment[talks_purchased]"&gt;
    &lt;option value="1"&gt;One&lt;/option&gt;
    &lt;option value="2"&gt;Three&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>This is the jQuery I'm using:</p>
  
  <pre><code>jQuery(document).ready(function() {
    var price = $(".total-price span.price")
    var save = $(".savings")
    $("#payment_talks_purchased").change(function() {
      var selection = $("#payment_talks_purchased").val()
      if (selection == 2) {
        price.html("$12");
        save.css("visibility", "visible");
      } else if (selection == 1) {
        price.html("$5");
        save.css("visibility", "hidden");
      }
    });  
  });
  </code></pre>
  
  <p>It works perfectly. It changes the price to $12 and shows the discount message. If I change the select option back to One/1, it changes the text back to $5 and removes the discount message.</p>
  
  <p>I converted this to CoffeeScript but it only works when I make the first change. The price is updated. However, when I try to change it back to option 1, it doesn't update.</p>
  
  <pre><code>jQuery -&gt;
    price = $(".total-price span.price")
    save = $(".savings")
    select = $("#payment_talks_purchased")
    select.change -&gt;
      selection = select.val()
      if selection = 2
        price.html "$12"
        return save.css "visibility", "visible"
      else if selection = 1
        price.html "$5"
        return save.css "visibility", "hidden"
  </code></pre>
  
  <p>I've been working on this for hours and am at my wits end. Any help would be greatly appreciated.</p>