`

Jquery 优先级

 
阅读更多

<html>
    <header>
        <title>test</title>
        <script src="./jquery-1.6.2.min.js"></script>
        <script type="text/javascript">           
           
            //优先级等同于$(function(){});
            $(document).ready(function() {
                c(1);
            });
           
            //优先级没有(function($){})(jQuery);高
            $(function(){
                c(2);
            });
           
            //优先级最高 等同于 $(c('test'));
            (function($){
                alert(3);
            })(jQuery);
           
            function c(a) {
                alert(a);
            }
        </script>
    </header>
   
    <body>
        test
    </body>
</html>

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics