jquery核心函数;jquery到$的转变过程

来源:互联网 发布:数据库读取慢怎么解决 编辑:程序博客网 时间:2024/06/09 22:24

注意:源生的js绑定,它只能绑定一次,而jquery允许绑定多次。

 

jQuery核心函数

$  jQuery是等效 的

$(function(){}); ---在页面加载完成后执行响应的代码

$(html)  ---html字符串转换成jQuery对象

$(selector, [context]); 在当前页面(指定对象中)使用css选择器查找响应对象并装换成jQuery对象

$(DOM对象)---DOM对象转换成jQuery对象

$()  --一个空的jquery对象

 

 

 

 

 

jQuery(callback)它是 $(document).ready() 的简写。

$(document).ready(function(){});页面加载完成后,指定的函数执行。

 

最完整的写法:

jQuery(document).ready(function(){

Slert(“hello jquery1”);

});

简写1

$(document).ready(function(){

Slert(“hello jquery2”);

});

简写2

jquery(function(){

Slert(“hello jquery3”);

});

 

简写3

$(function(){

Slert(“hello jquery4”);

});