Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialChristopher Wallace
6,277 PointsQuick Question,
When your creating Jquery code do you typically put all the code into one page or multiple pages
Christopher Wallace
6,277 Pointsi mean javascript file
1 Answer
Michael Liendo
15,326 PointsIn JavaScript, creating modular files is a best practice. Meaning, keeping small reusable parts together makes the most sense. Since jQuery is just a library that sits on top of javascript, the same is true. In one file, I might have jQuery that makes a call to the server and returns the contents. In another, I might have jQuery that adds elements to the DOM. It just depends on my need. To put shortly, you should never have a all your code in one .js file, though seemingly fine for smaller projects, it can turn into a nightmare to maintain as your projects become more complex.
Michael Liendo
15,326 PointsMichael Liendo
15,326 PointsWhen you say "page" do you mean webpage, or JavaScript file?