Kev*_*Kev 18 javascript jquery
允许在页面上声明jQuery文档就绪函数的次数,即:
$(function () { ... });
Run Code Online (Sandbox Code Playgroud)
要么
$(document).ready(function () { ... });
Run Code Online (Sandbox Code Playgroud)
这两者有什么区别吗?
如果允许不止一个,它们是否按照声明的顺序开火?
Dav*_*ang 18
一:两者没有区别.
引用:
All three of the following syntaxes are equivalent:
$(document).ready(handler)
$().ready(handler) (this is not recommended)
$(handler)
Run Code Online (Sandbox Code Playgroud)
二:你可以拥有任意数量的它们,它们将按照执行$()或$(document).ready()执行功能的顺序执行.(即每个处理程序都添加到队列中)
| 归档时间: |
|
| 查看次数: |
8415 次 |
| 最近记录: |