title: the jquery runs multiple times
body: <p>Sorry for my english :/
  I have a Jquery code that executes as many times as there is the div with class <code>newness</code>. Because <code>newness</code> is in one 'for'</p>
  
  <p>When I move my mouse on a div, I make the code JQuery below: remove 1 on the counter and I place a hoverdiv on this div(newness), and I post a db data, however for each item I have, there has a div newness, so it remake the action for many times that there are Articles I would like the jquery do only once the code </p>
  
  <p>I think the div have to be Unique like:</p>
  
  <pre><code>&lt;div class="newness-&lt;%=activity.id %&gt;
  </code></pre>
  
  <p>but i can't do that in the JQuery :</p>
  
  <pre><code>$('.newness-&lt;%=activity.id %&gt;')
  </code></pre>
  
  <p>If there are two activities in my DB the code below will add run twice the <code>Post</code> method and twice <code>--num</code> (counter).</p>
  
  <p>Here's the code:</p>
  
  <pre><code>&lt;div class="newness" data-id='&lt;%=activity.id %&gt;'&gt;NEW&lt;/div&gt;
  </code></pre>
  
  <p>jQuery, I have tried hover, it's the same.</p>
  
  <pre><code>$('.newness').one('mouseenter', function() {
    $(this).addClass('hover');
    var num = parseInt($.trim($('.body__activity_counter').html()));
    $('.body__activity_counter').html(--num);
    if (num == 0) {
      $('.body__activity_counter').addClass('hover');
    }
    newnessId = $(this).data('id');
    $.ajax({
      url: '/user_activities.json',
      method: 'POST',
      data: {
        user_activity: {
          activity_id: newnessId
        }
      }
    })
  })
  </code></pre>
  
  <p>If my mouse hovers this div and I have two activities, here are the logs:</p>
  
  <blockquote>
  <pre><code>  UserActivity Create (2.3ms)  INSERT INTO "user_activities" ("activity_id", "user_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id"  [["activity_id", 4], ["user_id", 2], ["created_at", "2018-05-28 10:59:26.615344"], ["updated_at", "2018-05-28 10:59:26.615344"]]
  
  ↳ app/controllers/user_activities_controller.rb:11
     (1.0ms)  COMMIT
  
  ↳ app/controllers/user_activities_controller.rb:11
    UserActivity Create (8.6ms)  INSERT INTO "user_activities" ("activity_id", "user_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id"  [["activity_id", 4], ["user_id", 2], ["created_at", "2018-05-28 10:59:26.617042"], ["updated_at", "2018-05-28 10:59:26.617042"]]
  
  ↳ app/controllers/user_activities_controller.rb:11
  </code></pre>
  </blockquote>