title: Jquery after updating ".attr" value "onclick" will show old value
body: <p>i'm trying to update the data-checkbox-name with this:</p>
  
  <pre><code>$(document).on("click", ".selectBtnAdmin", function(e)
  {
      $(".selectBtnAdmin").removeClass("selectedBtnAdmin");
      $(this).addClass("selectedBtnAdmin");
      var id = this.id;
  
      $("tr").each(function() {
          $(this).hide();
      });
      $("tr.head").show();
      $("input").attr("checked", false);
  
      if (id == "aktiv")
      {
          $("tr.aktiv").each(function() {
              $(this).fadeIn(400);
          });
          $("input.selectall").attr("data-checkbox-name","#1");
      }
      else if (id == "inaktiv")
      {
          $("tr.inaktiv").each(function() {
              $(this).fadeIn(400);
          }); 
          $("input.selectall").attr("data-checkbox-name","#2"); 
      }
      else if (id == "deaktiviert")
      {
          $("tr.deaktiviert").each(function() {
              $(this).fadeIn(400);
          }); 
          $("input.selectall").attr("data-checkbox-name","#3"); 
      }
      else if (id == "angenommen")
      {
          $("tr.angenommen").each(function() {
              $(this).fadeIn(400);
          }); 
          $("input.selectall").attr("data-checkbox-name","#4"); 
      }
  
      $("input.selectall").data("checkbox-name", "#2");
      $("input.selectall").data("data-checkbox-name", "#2");
  });
  </code></pre>
  
  <p>This works one time fine for me, but if i want to get the new value after a secound change of the "data-checkbox-name" it will show me the old one - so not "#3", but "#2".</p>
  
  <pre><code>$(document).on('click', ':checkbox.selectall', function(){
      alert($(this).data('checkbox-name'));
  });
  </code></pre>
  
  <p>Can anyone help me please?</p>