There are many other times, apart from the loading of the page, at which we might want to perform a task. Just as JavaScript allows us to intercept the page load event with <body onload="">or window.onload, it provides similar hooks for user-initiated events such as mouse clicks (onclick), form fields being modified (onchange), and windows changing size (onresize). When assigned directly to elements in the DOM, these hooks have similar drawbacks to the ones we outlined for onload. Therefore, jQuery offers an improved way of handling these events as well.
有很多时候,我们想绑定一些事件,而不仅仅是在加载网页的时候触发。正如js允许我们使用<body onload=''>和window.onload监听网页加载事件,他也提供了相似的拦截器用来对用户事件作出反应,比如鼠标的点击事件(onclick),表单元素被修改(onchange)和窗口大小被修改(onresize)。当我们直接绑定到DOM中的元素上的时候,这些拦截器和之前我们描述过的onload有着相似的缺点。因此,jquery对这些方法也提供了高级的处理方法。