title: jQuery after replacing attribute value getting old value
body: <p>I have span after img with attribute as clb-prodctid and its value is 280.</p>
  
  <p>It is a close image &amp; has background close image.</p>
  
  <p>I am using function to replace <code>data-clb-prodctid="280"</code> to <code>data-clb-prodctid="281"</code></p>
  
  <p>Replace is working fine and it assigns new value properly.</p>
  
  <p>But when I try to get the value, it gives me old value as 280.</p>
  
  <p>After page refresh I get new value as 281.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;img name="plus_icon" class="club_imgs imagefile club_imgs_1" data-clubprodnum="280" src="square.jpg"&gt;
      &lt;span class="close_button close-btn-icon" onclick="removeproduct(this)" data-clb-prodctid="280"&gt;X&lt;/span&gt;
  
      &lt;script&gt;
          function removeproduct(datas){                
              var remove_productId = jQuery(datas).data("clb-prodctid");
  
              alert(remove_productId);
  
              jQuery(".club_imgs_1").next('span').attr('data-clb-prodctid',281);                    
          }
      &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>