title: Add attribute value to HTML tag where value is equal to HTML tag's content
body: <p>I've found many similar questions but none quite did the trick for me. 
  Here's my situation: 
  I've got a span, the content of this span is a number dynamically inserted by Jquery. 
  This same span has an attribute, I want the value of this attribute to be equal to the number. </p>
  
  <p>I have tried to put the number in a variable and then add it trough .attr with Jquery but no luck there. Here's the code: </p>
  
  <pre><code>&lt;script&gt;
  
  var value= $('#min').html();
  $('#min').attr('data-category', value);
  
  &lt;/script&gt; 
  
  
  &lt;span class="filter" data-category="" id="min"&gt;&lt;/span&gt;
  </code></pre>
  
  <p>Any pointers will be greatly appreciated! Thanks :)</p>