1
I have a table
which I fill out this way below, I would like to know how I can check if you have data in it.
$("#tablepesquisaprodutos").append("<tr class='item'>"
+ "<td>" + "<input type='checkbox' class='link-check' onchange='cbChange(this);' />" + "</td>"
+ "<td>" + CodigoProduto + "</td>"
+ "<td>" + DescricaoProduto + "</td>"
+ "<td>" + Qtd + "</td>"
+ "<td>" + PrecoCusto + "</td>"
+ "<td>" + DescontoP + "</td>"
+ "<td>" + DescontoV + "</td>"
+ "<td>" + Total.toFixed(2).replace(".", ",") + "</td>"
+ "<td>" + ICMS + "</td>"
+ "<td>" + AliquotaICMS.replace(".", ",") + "</td>"
+ "<td>" + vICMS.toFixed(2).replace(".", ",") + "</td>"
+ "<td>" + ISS.replace(".", ",") + "</td>"
+ "<td>" + vISS.toFixed(2).replace(".", ",") + "</td>"
+ "<td>" + vIPI.toFixed(2).replace(".", ",") + "</td>"
+ "<td>" + QtdFalta + "</td>"
+ "<td>" + ProdutoID + "</td>"
+ "<td>" + DataEntrega + "</td>"
+ "</tr>")
I have tried some ways, but all do not identify the lines, as they are inserted dynamics.
Try it like this:
if($("#tablepesquisaprodutos td").length){ // possui colunas }
... this will check if it has columnstd
... if you want to see if you havetr
just change thetd
fortr
.– Sam
It worked fine, thank you.
– Mariana