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>
posted @ 2018-01-03 20:50  mysure  阅读(169)  评论(0编辑  收藏  举报