jQuery.fn是什么意思?是什么fn這里的意思?jQuery.fn.jquery
jQuery.fn是什么意思?
HUX布斯
2019-07-02 14:54:48
TA貢獻1869條經驗 獲得超4個贊
fnprototype.
jQuery.fn = jQuery.prototype = {
//list of functions available to the jQuery api}fnthis
$.fn.myExtension = function(){
var currentjQueryObject = this;
//work with currentObject
return this;//you can include this if you would like to support chaining};jsFiddle Demo$.fn.blueBorder = function(){
this.each(function(){
$(this).css("border","solid blue 2px");
});
return this;};$.fn.blueText = function(){
this.each(function(){
$(this).css("color","blue");
});
return this;};$('.blue').blueBorder().blueText();舉報