I am again having problem with JavaScript, which I think is related to it being loaded before a related element is added to the page. Previously (my original question is her