The argument about inline handlers being 'bad' stems from way back in the early days when web design started attracting programmers who weren't just designers with a bit of code. To those people, it was important to separate concerns, such as the user interface (HTML) and the logic (JS) - or in MVC terms, the View and Controller. In other words, the view should just worry about presenting stuff, and the controller should worry about handling behaviour.
The reality is that HTML tells the browser to trigger an event by placing an attribute on an element. Jquery just does this programmatically, but the result is the same as if you placed the attribute there yourself. So there is a lot of room for debate about best practice, and no one ever has to agree, which is great for parties, but bad for people who want to know the answer.
The benefits of keeping logic separate from the view are well documented (Google 'model-view-controller pattern').
I'd say we were getting to a point where separating out handlers was becoming accepted best practice. But frameworks like Angular have sent things into freefall, by allowing you to place not just event handlers in your HTML, but all kinds of logic, conditions and expressions.
So ultimately it comes down to a personal choice, which means you need to think through the pros and cons for your own situation. To help you, here are my own first thoughts on pros and cons.
PROs
- Makes it clearer what your HTML does to a designer
- Less code necessary
CONs
- Allows a designer to mess your program up just by tweaking the
design
- You have to look in multiple places to understand what's
going on
- More code required
For me personally, the first two cons are a big enough deal to make it a bad idea to place clicks inline...but your mileage may vary.
This leaves the question of where to place them. The options are
- In a
<script>
tag in the <head>
- In a
<script>
tag in the <body>
- beginning or end.
- In a separate
.js
file which is reference in the same way as 1. or 2.
Again, it all comes down to personal choice. For me, if I was writing a prototype with 20 lines of code, I might just chuck it into a tag in the header. But once it starts to grow, I would almost certainly separate it into a .js file, allowing me to ignore the mark up and just concentrate on the code.
Finally, where to call your script? This AGAIN comes down to personal choice. You have already started to answer your own question - you want your page to be interactive as soon as they are displayed. That makes it a good idea to put your scripts at the top of the page - but that will slow rendering. Putting them at the end of the page would allow the user to see stuff quicker, but have to wait for functionality to be created.
So all this is really a long way to say - it depends. And to be honest, your question shows you already know a lot of the pros and cons, so I would say go with what works for you, and ignore anyone who ever tells you there is a rule.