Reputation: 123
I have an ASP.NET web page with around 6000 lines of jQuery and JavaScript code. Not only does it drastically affect the performance of visual studio (it takes 30 seconds just to type a word) but it is now starting to affect the performance if my web page.
My jquery mostly consists of click events and AJAX functions. I am referencing most of my buttons and input fields by their ID.
I am just wondering what is the proper way to handle this amount of jquery code? I have tried to put it in an external .js file, but then i couldn't even get the code to run.
Surely there must be some way to have a large amount of jQuery and JavaScript code in my page without having it affect visual studio and affect my web page so drastically, right?
Upvotes: 0
Views: 54
Reputation: 39268
You definitely want to make sure the javascript is minified.
Also make sure you move it to an external file which will make it possible for the file to be cached by the browser.
These are the two most important things to consider. Just think about most javascript libraries out there - they are potentially pretty large codebases, but always in external files and minified.
Upvotes: 1