The document.ready is used to execute code after the DOM is fully loaded. This can be used to attach event handlers to elements on the page e.g
document.ready
When using actions to elements or calling them (that will be generated in DOM or don't exist yet) you need to use $(document).ready
$(document).ready