title: CoffeeScript: how to addClass unless
body: <p>Trying to add a class to all input elements <code>unless</code> that input element's <code>type == 'submit'</code></p>
  
  <pre><code>$('input, textarea') -&gt;
    unless $(@).getAttribute('type').val == "submit"
      $(@).addClass('form-control')
  </code></pre>
  
  <p>My Javascript debugging kit isn't very developed...so forced to decipher cryptic errors:</p>
  
  <pre><code>[Error] TypeError: '[object Object]' is not a function (evaluating '$('input, textarea')')
      ready (disk_files.js, line 37)
      dispatch (jquery.js, line 5096)
      handle (jquery.js, line 4767)
      dispatchEvent
      triggerEvent (turbolinks.js, line 199)
      onload (turbolinks.js, line 45)
  </code></pre>