Where is the ideal placement for JavaScript code that is specific to a partial view? For instance, if I have a partial view (loaded via an ajax call) with some divs and I want to convert those divs into an accordion, would it be more advantageous to include the $("#section").accordion() code in script tags within the partial view or in a .js file within the function responsible for fetching the partial view and inserting it into the DOM?
While common functions will be stored in a .js file, my main point of concern lies with JavaScript tailored specifically to the partial view itself.
The majority of online resources suggest isolating all JavaScript code in separate .js files, but there seems to be little discussion about the handling of partial views.