ASP.NET Web User Control with Javascript used multiple times on a page - How to make javascript func

Posted by Jason Summers on Stack Overflow See other posts from Stack Overflow or by Jason Summers
Published on 2010-04-12T21:08:29Z Indexed on 2010/04/12 21:13 UTC
Read the original article Hit count: 322

I think I summed up the question in the title. Here is some further elaboration...

I have a web user control that is used in multiple places, sometimes more than once on a given page.

The web user control has a specific set of JavaScript functions (mostly jQuery code) that are containted within *.js files and automatically inserted into page headers.

However, when I want to use the control more than once on a page, the *.js files are included 'n' number of times and, rightly so, the browser gets confused as to which control it's meant to be executing which function on.

What do I need to do in order to resolve this problem? I've been staring at this all day and I'm at a loss.

All comments greatly appreciated.

Jason

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about ASP.NET