title: Checking for existing object javascript or jquery
body: <p>the code that I have saves the html content of the clicked divs in localStorage, while clicking the 'Saved Events' button appends it to the #result div. My challenge is to check and see if objects already exist in #result first before appending, otherwise every time a user clicks the button it will add everything to the div again. </p>
  
  <p>here's the code</p>
  
  <pre><code>$(document).ready(function(){
      $(".selctor").click(function () {
          var i=$(this).attr("rel");
          console.log(i);
          var eventsArray=document.getElementsByClassName("eventer");
          eventSelctd=(eventsArray[i]).outerHTML;
  
          if (typeof(Storage) != "undefined") {
               localStorage.setItem("schedule "+ i, eventSelctd);
          }
          else {
          document.getElementById("#result").innerHTML = "Sorry, your browser does not support Web Storage...";
          }
      });
  
      $("#buttn1").click(function () {
      var storaged = Object.keys(localStorage);
      var storageLength = storaged.length;
  
      for (var i=0; i&lt;storageLength; i++ )
        {
        var key = localStorage.key(i);
        var value = localStorage[key];                
  
         $("#result").each( function() { 
         var resultRel = $("#result.eventer").attr(rel);
            if ((resultRel) != value) {
            $("#result").append(value);
            }
         });
        }
  
      });
  });
  </code></pre>