I’m trying to get my javascript to work on pages I load through the .load command.
$("#loadingDockShotPg").load("include/shot_comments.php");
I’m doing this to load a subsection of a page, but the problem is, the div within the newly loaded page isn’t being affected by my jQuery file that I have in the parent file. What is a better way to load content so that the newly injected can be affected by my javascript?
I’m assuming that you’re issue is with event listeners.
If, for example you’re using:
Try changing it out for:
This way the jQuery will listen for any clicks on the document and apply the action to events that match clicking on the
.somethingobject.