title: jQuery change custom attritbute
body: <p>I have an audio player in which a user can click on a play button next to songs in a list and the player begins streaming the audio. The play button swaps out for a pause button so that the user can pause the audio. The issue I am running into is that I can't swap a custom attribute out (data-player-action) from play to pause once the click happens:</p>
  
  <p>jQuery:</p>
  
  <pre><code>var playerInit;
  $('.btn-control').live("click", function() {
    var $action, $song_id, self;
    self = $(this);
    $action = self.attr('data-player-action');
    $song_id = self.parents("tr").attr('id');
    $(document.body).data('song-id', $song_id);
    playerInit($action, self);
    return false;
  });
  playerInit = function(action, elem) {
    var jw_content, playerData, self;
    self = $(elem);
    $('.tracks tr td').not(self.parent()).removeClass('currentlyPlaying');
    switch (action) {
      case "play":
        self.removeClass('play').addClass('pause');
        if (self.parent().hasClass('currentlyPlaying')) {
          jwplayer().play(true);
        } else {
          self.parent().addClass('currentlyPlaying');
          $('#player_area').slideDown('200');
          $('#player_wrapper').show();
          jw_content = jQuery.parseJSON(self.attr('data-player-feed'));
          playerData = {
            'streamer': jw_content.Location,
            'file': jw_content.Resource
          };
          jwplayer().load(playerData).play(true);
        }
        break;
      case "pause":
        self.removeClass('pause').addClass('play');
        jwplayer().pause();
        break;
      case "playAlbum":
        jwplayer().play(true);
    }
    return jwplayer().onComplete(function() {
      var $reloadPlayer;
      $(document.body).data('song-id', null);
      self.parentsUntil('.tracks').find('.pause').hide();
      self.parentsUntil('.tracks').find('.play').show();
      self.parent().removeClass('currentlyPlaying');
      return $reloadPlayer = true;
    });
  };
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;a href=\"#\" class=\"btn-control play\" data-player-action='play' data-artist-id='" + data["Artist"]["MnetId"] + "' data-album-id='" + data["MnetId"] + "' data-player-feed='" + x["SampleLocations"].first.to_json + "' data-player-position='0'&gt;&lt;/a&gt;
  </code></pre>
  
  <p>any help is greatly appreciated!!</p>