title: Check document for matching element by class
body: <p>I am loading content into my page from another page on my site using jq <code>.load()</code> on a click event. </p>
  
  <p>This is working fine, but I want to check the document for the class of the element that is loaded first before the content is loaded into the page in case the load has already been done. </p>
  
  <p>This is because there will be more than one click event on the page that can call the content. </p>
  
  <p>I have elements that initiate the click function which I have given the 'title' attribute matching the class of the element that is to be loaded. </p>
  
  <p>For example, if the element that I am loading into the page has the class <code>'loadedContent'</code></p>
  
  <p>I give each of the click elements that call this content the title <code>'loaded content'</code></p>
  
  <p>I am then getting this title from the click element, searching the document to see if there is any element that has a class matching that title. </p>
  
  <p>If there is an element already loaded on the page with a class matching the title, then I won't execute the load code. If there isn't, then the <code>.load()</code> function will execute. </p>
  
  <p>Currently I am obtaining the 'title' attribute from the click element, but I am unable to successfully search the document for a matching class. </p>
  
  <p>The code I thought should be simple, and currently have (after the click event):</p>
  
  <pre><code>var getLabel = $(this).parent().attr( "title" );
  if ($(document).hasClass( getLabel )) {
      // do a function
  }
  else {
      // perform load of content
  }
  </code></pre>
  
  <p>my load function is appending to the body, so it could potentially use body instead of document but either is not working. </p>
  
  <p>Not really sure where I should go from here as it should work.</p>