CoffeeScript: how to addClass unless
coffeescript, javascript, jquery, ruby-on-rails
Solution
$('input[type!=submit], textarea').addClass('form-control')
Problem
Trying to add a class to all input elements `unless` that input element's `type == 'submit'` ``` $('input, textarea') -> unless $(@).getAttribute('type').val == "submit" $(@).addClass('form-control') ``` My Javascript debugging kit isn't very developed...so forced to decipher cryptic errors: ``` [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) ```