Fix jshint errors.
Fix inverted logic.
Move all DOM interactions inside .ready function.