Outside ready function

Outside ready function

I already read some existing posts here and searched on google and still nothing.

  1. $(document).ready(function() {
       
        nav = function() {
           
            return {
                on: function(id) {
                    $(id).addClass('test');
                }
            }
           
        }
    });










How can i call the function on outside the document.ready.
I also did try window.nav and $.nav and the effect is the same.
It will only work if its in document.ready.