Skip to content

Instantly share code, notes, and snippets.

@kerin
Created October 4, 2013 16:09
Show Gist options
  • Save kerin/6828483 to your computer and use it in GitHub Desktop.
Save kerin/6828483 to your computer and use it in GitHub Desktop.
(function($){
$(function(){
...
});
})($ || django.jQuery);
@spjwebster
Copy link

Odd that this doesn't work. This does exactly what you'd expect:

<!DOCTYPE html>
<html>
    <head>
        <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
        <script>
            (function($){
                console.log('inside', $);
                $(function(){
                  console.log('ready')
                });
            })($ || jQuery);

            console.log('outside', $);
        </script>
    </head>
    <body>
    </body>
</html>

That said, I'm not sure how django's version of jquery differs from stock jquery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment