JQ 封装一个颜色插件

    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>extend</title>
    </head>
    <body>
        <input type="button" value="OK" style="color:red">
        <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
        <script>
            ;(function($) {
                $.fn.extend({
                    "color":function(value){
                        if( value== undefined){
                            return this.css("color")
                        }else{
                            return this.css("color",value)
                        }
                    }
                })
            })(jQuery)
            var x = $("input").color("pink");
        </script>
    </body>
    </html>
原文地址:https://www.cnblogs.com/ar13/p/8185619.html