What is the exact use of $(document).ready() in jQuery and can we have two $(document).ready() in a webpage?
Everything inside the $(document).ready() function will load as soon as the DOM is loaded and before the page contents are loaded.
You should wrap all your javascript code with this function to ensure that the code only runs when the page is fully rendered. Without it you could run into errors where the JavaScript can't find elements as they haven't rendered to the page yet.
And yes you can use it any number of times in a webpage.