0
In the table when pressing enter instead of activating the javascript event this being inserted a break line, ie the text function of enter not the event.
// Função
$(function() {
//Função click na celula
$('td').click(function() {
//Salva o conteudo da celula
var conteudoOriginal = $(this).text();
//$(this).html("<input type='text' value='" + conteudoOriginal + "' />");
//Função toggleClass Troca as classes
$(this).toggleClass("Comfoco");
// Salva a edição ao apertar enter
$(this).keypress(function(event) {
if (event.which == 13) {
conteudoOriginal = $(this).text();
$(this).toggleClass("teste2");
}
});
// Ao perde o foco retira a classe vermelha
$(this).blur(function() {
$(this).toggleClass("teste2");
$(this).text(conteudoOriginal);
});
//
});
});
}
},
error: function(xhr, ajaxOptions, thrownError) {
alert(thrownError);
}
});
}
In my case I use <td contenteditable> instead of imput it affects something ?
– mateus lacerda
@mateuslacerda does not change. I edited my answer. I changed an example of
input
fortd
– Valdeir Psr
Dude you were extremely cool I turned your I’m beginner in this language you helped me mt with a very didactic response
– mateus lacerda
If you think you have answered the question click on the little green sign below the question score to mark as answered.
– Bruno Romualdo