jQuery启蒙: $ 与 ()
我第一次看到jQuery里出现最多的$符号,也被搞糊涂了。原来,JavaScript的语法里,变量的名字可以是一个$符号。在jQuery里,$就代表jQuery。
我们经常要写类似这样的代码
(function($) {
$(function(){
$('a').each(function() {
$(this).css({'background-color': 'red'});
});
});
})(jQuery);
看起来很酷吧!
您二位都是高手,俺全没看懂,膜拜下。
页:
[1]