on should be used to bind events over .click()
all script should be place together
inline code should be pushed to a controller script

in this case you are using test.js as a controller script and that is
where you place all page by page code.
for best practice you should declare the type with scripts

It is possible to have the <script> not be javascript, so it is a good
idea to use the types and not let a browser assume anything