Now I know this basic question has been asked before, but I must be doing something wrong. I know that an appended element must bound before I can do anything to it. However, try as I might I can't get it to work.
I am pulling in a message and displaying when people click a radio select. When ever I try to bind the new element, it stacks in odd ways. It will start to stack the elements. eg- [Click 1]message 1, [Click 2] message 1 and 2 and so on.
I have tried a whole bunch of different ways to bind it. My hope was the remove would strip #feedback and then create and bind the next message. I must be doing something terribly wrong. I know this is very similar to other posts, but I went through all of them and was not able to find a clear enough answer to help. Thank you in advance.
The HTML
<div class="answers">
<ul>
<li>
<input id="answer" type="radio" onclick="feedback('THE MESSAGE HTML')"><label>Label</label>
</li>
</ul>
</div>
JavaScript:
function feedback(message)
{
$('#answer').live('click', function()
{
$('#feedback').remove();
});
$('#answer').live('click', function()
{
$('.answers').append('<div id="feedback">'+message+'</div>');
});
};