Add fixes for js

- unify the event handlers to `.on()`
- modify some indentation
- remove white space
- use `===`  operator instead  `==`