You can put it anywhere… in the index.html.erb or in layouts or in some external javascript… in third case make sure that you are calling that javascript like
Dude your javascript is not getting loaded when your submit button is pressed… look carefully when you are calling javascript… try to alert some text to see what’s going wrong there
That's a bizarre set of recommendations, especially given that Doug
Crockford, Yahoo!'s own JS architect, recommends that JS not be mixed in
with HTML at all.
Other than one specific case of a certain kind of landing page, I
don't see a recommendation there to mix javascript and html.
They recommend combining multiple script resources into one, minifying etc.
I take putting the javascript at the bottom as putting the script tags
referencing the separate script resource(s) at the bottom not inlining
javascript in the page.