jQuery

作者: 66pillow | 来源:发表于2017-12-16 16:54 被阅读0次

插件开发

$.extend扩展jQuery方法,$.myFun()
$.fn向jQuery添加新方法,$("#myDiv").myFun()
$.widget向jQuery UI

$.extend({
    sayHello: function(name){
        alert(name);
    }
});
$.sayHello('66');

$.fn.myPlugin = function(){
    //this指向jQuery选中控件
    this.css('color', 'red');
};

$('#myDiv').myPlugin();

相关文章

网友评论

      本文标题:jQuery

      本文链接:https://www.haomeiwen.com/subject/umoswxtx.html