Possible Duplicate:
Bind an event handler on a element who’s inserted by the jQuery .html() function
Below is a simple jquery script. When the user hit #FAC a textbox appears, the value is entered. When #cs is clicked the valued entered in #NC should appear as alert. But it does not, any ideas to why?
$('#FAC').click(function() {
$('#FAC').html('<input type="text" name="NC" id="NC"><input type="button" value="Ok" id="CS">');
});
$('#NC').click(function() {
alert($('#NC').val());
});
If I have understand well your problem try this:
JSFIDDLE