Changing a field with a respective color

Asked

Viewed 34 times

0

I’m having a doubt not your where to start I have a project based on an hourly calendar in which this calendar has a table with several squares and I need to change the color of these squares with some colors corresponding to a status and I must return this status back to the changed bank i thought to do where the user clicks on the square opens a color palette with the color change and each color is related to a status but do not know how to get started

the calendar is equal to the image below inserir a descrição da imagem aqui

  • Explain your question better. Calendar in which excel, html?

  • html image is just to get an idea of how it will look

  • Okay, now post the code you’ve developed so far if possible to get more help.

1 answer

0

0 vote against Accept $(Function () { $("td"). dblclick(Function () { var conteudOriginal = $(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(conteudoOriginal); $(this). Parent(). removeClass("cellulaEmEdical"); }); }); });

$(Function() { var text = $("#tableEditable td:Nth-Child(1) td:Nth-Child(6)"). text(); 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"); } });

  • this is the java script I made each letter a - b -c -d has a corresponding color

Browser other questions tagged

You are not signed in. Login or sign up in order to post.