[jQuery] click a button returned by ajax
I have a button that do appear on my page through a post with jquery:
$.post(
'more_item.php',{
NumItem: NumeroItem,
Str : $("#form-itens").serialize()
},
function(data){
NumeroItem = new Number(NumeroItem + 1);
$('#NumItem').val(NumeroItem);
var htmlStr = $('#resut_itens').html();
$('#resut_itens').html(data);
}
);
it returns me a clickable link:
<a href="javascript:void(0);" id="BtMoreDefeito"> Default </ a>
I want to create a JQUERY that clicking this BtMoreDefeito execute a
POST:
$('#BtMoreDefeito').click(function(){
$.post(
'more_defeito.php',{
NumDef: NumDef,
Str : $("#form-defeitos").serialize()
},
function(data){
NumDef = new Number(NumDef + 1);
$('#NumItem').val(NumDef);
var htmlStr = $('#result_defeitos').html();
$('#result_defeitos').html(data);
}
);
});
but this has not worked. the latter showed that jquery is inserted in
the index.
the main page that calls the button.
jquery in a home can act on an ID loaded from another file with ajax?