0
vote against
accept
$ function () {$ ("td"). dblclick (function () {var conteudoOriginal = $ (this) .text ();
$(this).addClass("celulaEmEdicao");
$(this).html("<input type='text' value='" + conteudoOriginal + "' />");
$(this).children().first().focus();
$(this).children().first().keypress(function (e) {
if (e.which == 13) {
var novoConteudo = $(this).val();
$(this).parent().text(novoConteudo);
$(this).parent().removeClass("celulaEmEdicao");
}
});
$ (this) .children (). first (). blur (function () {
$ (this) .parent (). text (contentOriginal);
$ (this) .parent (). removeClass ("cellEmEdit");
});
});
});
$ (function () {var text = $ ("#Editable table td: nth-child (1) td: nth-child (6)").
var result = (text);
if (result == "a") {$ ("# idTd"). css ("background", "# FF0000"); } else if (result == "b") {$ ("# idTd"). css ("background", "# 00FF00"); } else if (result == "c") {$ ("# idTd"). css ("background", "# 0000FF"); } else if (result == "d") {$ ("# idTd"). css ("background", "# 00FFFF"); } else {$ ("# idTd"). css ("background", "# ccc"); }
});