根据您的个性需求进行定制 先人一步 抢占小程序红利时代
jQuery对象本质上是一种类数组对象
var $$ = function (nodeList) {
return new $$.fn.init(nodeList);
};
$$.fn= $$.prototype = {
toString:function () {
return this.slice();
},
constructor: $$,
init:function ( arr ) { // 创建类数组对象 for (var i = 0, l = arr.length; i
使用示例:var para = $$( document.getElementsByTagName('p') );
para.each(function(){
this.className += " " + 'goodbye';
});