码迷,mamicode.com
首页 > 其他好文 > 详细

JQ 封装一个颜色插件

时间:2018-01-03 22:38:21      阅读:130      评论:0      收藏:0      [点我收藏+]

标签:col   插件   def   1.4   red   return   .com   lan   1.0   

    <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>

JQ 封装一个颜色插件

标签:col   插件   def   1.4   red   return   .com   lan   1.0   

原文地址:https://www.cnblogs.com/ar13/p/8185619.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!