The live
function is registering a click event handler. It'll do so every time you click the object. So if you click it twice, you're assigning two click handlers to the object. You're also assigning a click handler here:
onclick="feedback('the message html')";
And then that click handler is assigning another click handler via live()
.
Really what I think you want to do is this:
function feedback(message)
{
$('#feedback').remove();
$('.answers').append('<div id="feedback">'+message+'</div>');
}
Ok, per your comment, try taking out the onclick
part of the <a>
element and instead, putting this in a document.ready()
handler.
$('#answer').live('click',function(){
$('#feedback').remove();
$('.answers').append('<div id="feedback">'+message+'</div>');
});