I'm building a music site I have a section where you click a artist name an I use jquery to send the artist id to the DB and pull all songs under his name, then I list them in a div on the page as links.
My problem is, whenever I use .text or .val to amend the song titles in a div, if he has 2 songs, it only shows the first song title.
However, if I use .append, when I click 1 artist name, it pulls all his song fine, but if I click another artist name on the same page it adds his songs below the ones for the previous artist.
Only list 1 song, even if there is 2;
$.each(data.resultData, function(key, value) {
$('value.SongTitles').text(value.artistName +':' + songTitle).fadeIn();
});
List all songs fine, but doesn't clear previous artist songs after a new artist name is clicked;
$.each(data.resultData, function(key, value) {
$('value.SongTitles').append(value.artistName +':' + songTitle).fadeIn();
});