Jquery知识点一 Jquery的ready和Dom的onload的区别_jquery

WBOY
Release: 2016-05-16 18:12:08
Original
1028 people have browsed it

所以相对来说jquery的ready可以提高网页的响应速度;
jquery:ready的标准写法:

复制代码代码如下:

$(document).ready(function() {
alert("加载结束");
});

一个$(document)将dom对象的document转化为jquery对象,继而可以调用jquery的方法ready();因为dom对象是不可以调用jquery的方法的,虽然他们的关系很亲密;
jquery:ready的简写形式:
复制代码代码如下:

$(function() {
alert("加载结束");
});

ready函数的一个主要作用就是为dom对象注册事件:
复制代码代码如下:












Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!