当前位置: 代码迷 >> .NET相关 >> $.fn跟$.extend书写方式
  详细解决方案

$.fn跟$.extend书写方式

热度:181   发布时间:2016-04-24 02:35:19.0
$.fn和$.extend书写方式

$.extend({
addMe:function(a,b){
console.log(a + b);
}
});

$.fn.extend({
showTest:function(){

console.log(this);
}
});


$.extend($.fn,{
showAge:function(){
console.log(this[0].dataset.age);


}
});


$("#test").showAge();
$("#test").showTest();
$.addMe(4,9);

 

此上三种写法都可以