I have a code like this:
$(document).ready(function () { $('.accessLink') .bind('click', accessLinkClick); $('#logoutLink') .click(function (e) { window.location = $(this).attr('data-href') }); });
The functionality for each part of my site is divided into several small files, and when the site is deployed, they are simulated and combined.
Each of these small files, which number up to ten, is waiting on $ (document) .ready. Can anyone tell me if there is any overhead at the same time. Dividing my code into functional areas meant that the code looked easy to maintain, but right now I'm just curious that I'm using jQuery 1.8.1
Update:
Based on the answers, I started writing as follows:
$(document).ready(function () { accessButtons();
with each function then encoded as:
function accessButtons() { $('.accessLink') .bind('click', accessLinkClick); $('#logoutLink') .click(function (e) { window.location = $(this).attr('data-href') }); };
Alan2 source share