in moodle , the way of writting javascript has changed.
you can use followin basic to get the document ready in using jquery
Mustache Tempate
{{#js}}
require(['jquery'], function($){
    $(document).ready(function(){
         alert("hello");
    });
});
{{/js}}In PHP File
require(['jquery'], function($){
    $(document).ready(function(){
         alert("hello");
    });
});