<commit_before># sudojQuery

> Safely use .ready() before including jQuery

All credit goes to [@collypops](https://twitter.com/collypops) for his article [Safely using .ready() before including jQuery](http://writing.colin-gourlay.com/safely-using-ready-before-including-jquery/).

SudojQuery allows you to include jQuery code anywhere in your HTML, even before including jQuery. This allows you to load jQuery at the bottom of your page to prevent render blocking.

Minified, the `sudojQuery-start` and `sudojQuery-end` files are only **209 bytes** and **123 bytes** respectively.

##### Bower Installation

```
bower install sudojQuery
```

### Usage

To use sudojQuery, place the `sudojQuery-start.min.js` file in the `<head>` section of your HTML, and place the `sudojQuery-end.min.js` file after your inclusion of jQuery, and you're good to go.<commit_msg>adding example code to docs<commit_after># sudojQuery

> Safely use .ready() before including jQuery

All credit goes to [@collypops](https://twitter.com/collypops) for his article [Safely using .ready() before including jQuery](http://writing.colin-gourlay.com/safely-using-ready-before-including-jquery/).

SudojQuery allows you to include jQuery code anywhere in your HTML, even before including jQuery. This allows you to load jQuery at the bottom of your page to prevent render blocking.

Minified, the `sudojQuery-start` and `sudojQuery-end` files are only **209 bytes** and **123 bytes** respectively.

##### Bower Installation

```
bower install sudojQuery
```

### Usage

To use sudojQuery, place the `sudojQuery-start.min.js` file in the `<head>` section of your HTML, and place the `sudojQuery-end.min.js` file after your inclusion of jQuery, and you're good to go:

```html
<head>
    
    ...
    
    <!-- sudojQuery start -->
    <script src="sudojQuery-start.min.js"></script>
    
</head>

<body>
    
    <script>
        <!-- some jQuery code -->
        $(document).ready(function() {
            alert("Success!");
        });
        jQuery(document).ready(function() {
            alert("Success!");
        });
    </script>
    
    <!-- jQuery -->
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
    
    <!-- sudojQuery end -->
    <script src="sudojQuery-end.min.js"></script>
    
    
</body>
```

> Note that your jQuery code must be containt within a document.ready function, as shown above.
{'fraction_non_alphanumeric': 0.12968299711815562, 'fraction_numerical': 0.006175380815150268, 'mean_word_length': 3.5, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 24, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '158183', 'n_tokens_mistral': 749, 'n_tokens_neox': 711, 'n_words': 247}