title: Trying to pass data using data tag
body: <p>I am appending a link with a data attribute to a DIV. When this DIV is clicked, I need to reload the page and call a function. I am trying to pass a data-attribute called url and on page refresh detect if the data url exists and execute the correct function. Can anyone explain what I am doing wrong? I am using a sample URL for this example.</p>
  
  <pre><code>$('.activeCategory').html('&lt;a href="http://www.test.com"' + 'data-url="www.test.com#path' + '"&gt;' + "www.test.com" + '&lt;/a&gt;');
  
  $('.activeCategory').click(function() {
      if ($(this).attr('data-url') == 'http://www.test.com#path') 
      { 
        exampleFunction();
      }
  });
  </code></pre>