读书人

(四)事件处理(5)为代码简洁做

发布时间: 2013-10-11 14:52:39 作者: rapoo

(4)事件处理——(5)为代码简洁做的快捷方式(Shortcuts for code brevity)
The $(document).ready()construct is actually calling the .ready()method on a jQuery object we've constructed from the documentDOM element. The $()function provides a shortcut for us as this is a common task. When we pass in a function as the argument, jQuery performs an implicit call to .ready(). For the same result as shown in the following code snippet:

$(function() {// Our code here...});
虽然另一种语法更加短,但是这个长的让更好的描述了他在做的事情。由于这个原因,我们将在整本书中使用长一些的语法。

读书人网 >Web前端

热点推荐