3 ms·
Can you elaborate why $(document).ready() should not be used?
by robert-boehnke 15y ago
Can you elaborate why $(document).ready() should not be used?
- weixiyen 15y agoIt's a matter of best practices. In particular how it's done in this code, where it's outside the definition of the plugin and binding events. Plugins should be built in a way where it is explicitly invoked by the programmers using them, and the 'proper' way is to invoke them from within a $(document).ready() function that is specified by the user in the order that the user wants. Lets pretend, for example, that this plugin is invoked from within another $(document).ready(), in which case the document.ready call from within the plugin is completely redundant and useless.
- cgcardona 15y agoYour points are all valid and I'll consider each one in refactoring the code. Thanks!