jQuery.fn是什么意思?是什么fn这里的意思?jQuery.fn.jquery
3 回答
MMTTMM
TA贡献1869条经验 获得超4个赞
fn
prototype
.
jQuery.fn = jQuery.prototype = { //list of functions available to the jQuery api}
fn
this
$.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();
添加回答
举报
0/150
提交
取消