I am trying to create text editing myself by simply manipulating jQuery selectors. But after the first ajax callback, the other callbacks for the same input text no longer work ...
function editaVal(celDiv, id)
{
var novoConteudo = $("<input type='text' id='novoCont" + id + "' value='" + $(celDiv).html() + "' />");
$(celDiv).dblclick(function()
{
$(this).html(novoConteudo);
});
$(novoConteudo).blur(function()
{
$(novoConteudo).parents("tr").removeClass('trSelected');
$.ajax({
type: 'POST',
url: '/SuperAdmin/SalvaValor/?busca=' + $(novoConteudo).val() + '&codValor=' + id,
beforeSend: function()
{
$(celDiv).html($("#loading").show());
},
success: function()
{
$(celDiv).html($("#loading").hide());
$(celDiv).html(novoConteudo.val());
}
});
});
}
My question is: how can I rebuild this ??? Cancel the blur event ... When I blur the input text, nothing happens in the second ajax callback.
thanks!!
source
share