撰写jQuery $(document).ready函数的较短的形式 [英] Shorter form of writing jQuery $(document).ready function
本文介绍了撰写jQuery $(document).ready函数的较短的形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用了很多jQuery,所以我必须继续输入 $(document).ready
函数来放置jQuery代码。 ?是否有功能的较短形式
解决方案
在以下三个语法被允许的:
语法1
$(document).ready(function)
$ c $语法2 $()。 ready(function)
语法3
$(函数)
更新:
此外,从版本1.9开始:
$(窗口).on('load',null,function)
$(document).on('ready',null,function)
I use a lot of jQuery, so I have to keep typing out the $(document).ready
function to put the jQuery code. Is there a shorter form of the function?
解决方案 The three following syntaxes are allowed:
Syntax 1
$(document).ready(function)
Syntax 2
$().ready(function)
Syntax 3
$(function)
Update:
Additionally, from version 1.9 onwards:
$(window).on('load', null, function)
$(document).on('ready', null, function)
这篇关于撰写jQuery $(document).ready函数的较短的形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文