title: only add script to head if doesn't exist
body: <p>I want to add additional scripts and styles to my site when a specific <code>div</code> is loaded.
  I start out by defining a path to either a script or stylesheet and then create an element. Hereafter I append the element to the head tag in HTML.</p>
  
  <p>But I would like a way to see if the script or stylesheet already has been append before I append it again. It would be stupid to append an already existing script or stylesheet.</p>
  
  <p>Q: How do I use javascript to check wether or not a script already exists in the head tag, and then append the element if not?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I have made a function based on the answer from @KernelPanik. It doesn't work yet but hopefully it will. The function is currently in question: <a href="https://stackoverflow.com/questions/15988186/my-script-appending-function-doesnt-work">my script appending function doesn&#39;t work</a></p>