jquery 拓展函数集

方式: 通过拓展在调用$()时返回的包装器

1.将函数绑定到$.fn

$.fn.disable = function(){

  return this.each(function(){

    if (typeof this.disabled != 'undefined') this.disabled = true;

  });

}

2.调用

$("#myid input").disable();

 

 

note: release JQuery in Action

posted @ 2016-02-18 13:57  fangfan  阅读(206)  评论(0编辑  收藏  举报