typo fix, "automaticly" to "automatically"
correct syntax for .on()