1、JQuery中$(function() {...}是 $(document).ready(function(){...})的简写形式
2、自定义函数
工具函数和包装器函数
http://my.oschina.net/chinahub/blog/540624
3、插件 http://www.cnblogs.com/Wayou/p/jquery_plugin_tutorial.html
3.1 命名规则 jquery.****.js
3.2 传递jquery到定义参数为$的函数,确保$在函数体内引用jQuery
($function($){
//plugin defination here
})(jQuery)
4、函数的定义 http://www.cnblogs.com/echoloyuk/archive/2012/11/20/2778721.html
function sum(a,b){
return a+b;
}
return a+b;
}
函数直接量:
var sum=function(a,b){ return a+b; }
5、类的定义
(function ($) { $.DragField = function (arg) { var name = "你好"; //这个是私有变量,外部无法访问 this.testFun = function () { //this.testFun方法,加上了this,就是公有方法了,外部可以访问。 alert(arg.title + "," + name); }; }; })(jQuery); //使用 var a = new $.DragField({ title: "Hi" }); var b = new $.DragField({ title: "Hello" }); a.testFun(); b.testFun();
注:在JavaScript,一切都是对象。JavaScript中就是使用function关键字来定义类的
http://hushicai.com/2014/03/02/jquery-zheng-ti-jia-gou.html jquery整体架构
6、变量的作用域 http://www.cnblogs.com/snandy/archive/2011/03/19/1988284.html
var tmp 全局变量(在函数内部定义才是局部变量)
tmp 全局变量
7、jQuery正则匹配
浙公网安备 33010602011771号