From what I can see, most of the examples and answers show how to run a partial's JavaScript when the page initially loads.
In this case, the partial doesn't load until later, triggered by a button click using AJAX.
I have experimented with placing my JS code inside:
$(document).ready(function () {
AND :
$(function(){
AND :
By itself
The first method doesn't work at all. The second and third methods seem to trigger only on the second page load. This is likely because the div that my JavaScript affects does not exist initially. So my question remains: How do I make it run when the partial loads?