I put the following function in my application.js:
function test() {
alert(\"See Me\")
}
classrooms/_new_small.html.haml:
I noticed your function test()
is indented, which suggests it is nested. If you define a function in the scope of another function, it will not be available outside of it.
For example this should work, using jQuery:
function test() { /* do something */ }
// another file or inline script
$(function() {
test();
});
But this won't
(function() {
function test() {}
})();
// another file
test(); // undefined