I'm trying to put the color inside the conditional, but I can not. PS: There are three different colors and it can only be done with JQuery.
<script>
var qtd;
$(function () {
$("#btn1").click(cadastrarDados);
$("#btn2").click(exibirDados);
if (localStorage.getItem("qtd") == null) {
qtd = 0;
} else {
qtd = parseInt(localStorage.getItem("qtd"));
}
});
function cadastrarDados() {
qtd++;
localStorage.setItem("rgm" + qtd, $("#rgm").val());
localStorage.setItem("nome" + qtd, $("#nome").val());
localStorage.setItem("parcial" + qtd, $("#parcial").val());
localStorage.setItem("projeto" + qtd, $("#projeto").val());
localStorage.setItem("regimental" + qtd, $("#regimental").val());
localStorage.setItem("qtd", qtd);
}
function exibirDados() {
if (qtd < 1) {
alert("nada")
} else {
var conteudo = "<table border='1'>" + "<th>" + "Nome" + "</th>" + "<th>" + "RGM" + "</th>" + "<th>" + "Nota Parcial" + "</th>" + "<th>" + "Nota Projeto" + "</th>" + "<th>" + "Nota Regimental" + "</th>" + "<th>" + "Nota final" + "</th>" + "<th>" + "Conceito" + "</th>";
for (var i = 1; i <= qtd; i++) {
var notaparcial, notaprojeto, notaregimental, media;
notaparcial = parseFloat(localStorage.getItem("parcial" + i));
notaprojeto = parseFloat(localStorage.getItem("projeto" + i));
notaregimental = parseFloat(localStorage.getItem("projeto" + i));
media = notaparcial + notaprojeto + notaregimental;
if (media >= 6) {
conceito = "Aprovado";
} else if (media < 6 && media > 1) {
conceito = "AF";
} else {
conceito = "Reprovado";
}
conteudo += "<tr>"
conteudo += "<td>" + localStorage.getItem("rgm" + i) + "</td>"
conteudo += "<td>" + localStorage.getItem("nome" + i) + "</td>"
conteudo += "<td>" + localStorage.getItem("parcial" + i) + "</td>"
conteudo += "<td>" + localStorage.getItem("projeto" + i) + "</td>"
conteudo += "<td>" + localStorage.getItem("regimental" + i) + "</td>"
conteudo += "<td>" + media + "</td>"
conteudo += "<td>" + conceito + "</td>"
conteudo += "</tr>"