I'm working on my first ASP.NET MVC 3 application with utilizes some JavaScript and jQuery here and there. I ran into a problem with a particular jQuery plugin that ended up being referenced multiple times and this resulted in a stackoverflow/too much recursion error when I tried to use the plugin on the page. Moving this out of my partial view file and into the _Layout.cshtml caused the error to go away, but I'm thinking this isn't really the solution either.
I'm still very new to JavaScript and jQuery and was wondering if there's a guard, like I would use in a C file to avoid multiple includes of a particular header file, to do likewise with a JavaScript file.
Or, if there's a better way to handle this, I'd be interested in hearing how. Perhaps it is an issue just with this particular plugin file. Any guidance on this?