$('#answer').on('click', function() { feedback('hey there'); }); var counter = 0; function feedback(message) { $('#feedback').remove(); $('.answers').append('<div id="feedback">' + message + ' ' + counter + '</div>'); counter++; }