Hi all

I have a small jQuery snippet which finally works, I have this code within a global js file which triggers on every page. How can I make it run only when it finds the correct ID?

I would like to run the below only with the page that has the page ID of #listings

Code JavaScript:
$('.placeholder').before('<div class="napp"><img src="images/napp.png"></div>');

I'm working with other peroples code and came across, below, which has all different snippets running for that page under different self.initialize. Example: self.initializeArticle, self.initializeFrontage and so on.

Code JavaScript:
self.initializeFrontpage = function() {
$('.placeholder').before('<div class="napp"><img src="images/napp.png"></div>'); // example
}

How can I add my own self.initialize? What does it mean? And where does the Frontpage, Article come from?

Many thanks,
Barry