jquery文档的入口点 [英] Entry point for jquery document

查看:86
本文介绍了jquery文档的入口点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在每个JQuery教程中,入口点总是如下:

In every JQuery tutorial the entry point is always like this:

$(document).ready(function() {
   ...
});

但是在 sdoc 项目对于我的新手来说,它有不同的切入点。
这是代码片段和那里有完整档案:

But in sdoc project it has different entry point as for my novice's view. Here's the code snippet and there the full file:

<script type="text/javascript" charset="utf-8">
    //<![CDATA[
    function placeholder() {
        ...
    }
    $(function() {
       placeholder();
       ...
    })
    //]]>
</script>

问题: $(function()..) jquery脚本的入口点?如果它与传统方法有所不同?谢谢

The question: Is $(function()..) the entry point for jquery script? And if it does why it differ from traditional approach? Thanks

推荐答案

它是一样的。来自 .ready()的jQuery文档


以下所有三种语法
都是等价的:

All three of the following syntaxes are equivalent:

$(document).ready(handler)
$().ready(handler) (this is not recommended)
$(handler)


这篇关于jquery文档的入口点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆