title: Setting a value dynamically for data attributes using jquery
body: <p>I use data attributes extensively for managing data in client side events. Is it possible to assign value dynamically to a data attribute using javascript or jquery?</p>
  
  <pre><code>&lt;li data-class_value="somevalue" class="myclass"&gt;&lt;/li&gt;
  
  
  $('.myclass').click(function(){
     $(this).data('class_value') = "new value";
  });
  </code></pre>
  
  <p>The above javascript code throws the error:</p>
  
  <blockquote>
    <p>"Uncaught ReferenceError: Invalid left-hand side in assignment". </p>
  </blockquote>
  
  <p>Could someone please tell me how this can be achieved?</p>