Understanding how jquery works