Trying here to change the value of data-foo

Trying here to change the value of data-foo

Hi,

Im trying here to change the value of data-foo, but it doesn't work..

  1. <li class="jander" data-foo="bar1">Item</li>
  1. $( document ).ready(function() {
  2.     $('li').attr('class','clander');  
  3.     $('li').data('foo', 'bar2');
  4. });