编写一个jquery插件

 

<head>
<script type="text/javascript">
//编写一个名字为color的jquery插件
; (function ($) {
jQuery.fn.extend({
"color": function (value) {
return this.css("color",value);
}
});
})(jQuery);
 
//调用
$(function () {
alert($("body").color("gray"));
});
</script>
</head>
原文地址:https://www.cnblogs.com/xiexingen/p/2706171.html