Best placement for javascript in Asp.net MVC app that heavily uses partial views

Posted by KallDrexx on Stack Overflow See other posts from Stack Overflow or by KallDrexx
Published on 2010-04-24T03:58:53Z Indexed on 2010/04/24 4:03 UTC
Read the original article Hit count: 364

Filed under:
|
|

What is the best place for javascript that is specific to a partial view? For example, if I have a partial view (loaded via ajax call) with some divs and I want to turn those divs into an accordian, would it be better put the $("#section").accordion() in script tags inside of the partial view, or in a .js file in the function that retrieves that partial view and inserts it into the DOM?

Obviously, common methods I will be keeping in a .js file, however I am more talking about javascript very specific to the partial view itself.

Most things I find on the net seem to say to put all javascript into a separate .js but nothing addresses the idea of partial views.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about asp.net-mvc