Bind function not defined while correct referencing original file

rails
javascript
ruby

#1

I’m working on an existing rails app with walk-thru tutorial and am getting stuck with the “bind” function for javascript.

My define of the function is here:
function bind1() {
('.cost').blur(update_price); (’.qty’).blur(update_price);
}

and then referenced here:
bind1();
});
bind1();

$('body').on('click',

I went to the tutorials github repo and copied them same to input them instead of perchance writing something with a minor error but got the same.

Does the BIND function work via JS in a rails box on cloud9?


#2

Cloud9 can’t detect global functions defined in other files as it has no idea where to look (as it doesn’t know that this file and the other one are on the same page). That warning won’t stop you from being able to run your code. If you’d like it to go away simply add /*global bind1*/ to the top of the file.