示例代码:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>jQuery扩展的两种方法</title>
    <style>
        div{
            cursor: pointer;
        }
    </style>
</head>
<body>
    <div id="i1">看帅哥吧</div>
    <div id="i2">看美女吧</div>
    
    <script src="jquery-1.12.4.js"></script>
    <script>
        $.extend({
            "chong" :function () {
                return "帅哥";
            }
        });

        $.fn.extend({
            "dan":function () {
               return "美女"; 
            }
        });
        
        $('#i1').click(function () {
            var boy = $.chong();
            alert(boy);
        });

        $('#i2').click(function () {
            var girl = $('#i2').dan();
            alert(girl);
        });
    </script>
</body>
</html>