-2
I have a table with several columns and rows I want to put a red border indicating where the user can type in case the limit would be age. I have been able to count how many times the header class appears, but I want to take this number and pass in the class "line1" only to put the edge to where the age is
$(".nome").on("keyup", function () {
var i = $('.nome).index(this);
if ($(".codigo").eq(i).val().length > 0) {
var j = i + 1;
var linha = '.linha' + j;
$(linha).each(function () {
$(linha).addClass('bordavermelha');
});
} else {
var j = i + 1;
var linha = '.linha' + j;
$(linha).each(function () {
$(linha).removeClass('bordavermelha');
});
}
});
<table>
<tr>
<td class="cabecalho">Id</td>
<td class="cabecalho">Nome</td>
<td class="cabecalho">Idade</td>
<td class="cabecalho">Função</td>
<td class="cabecalho">tempo</td>
</tr>
<tr>
<td>1</td>
<td><input class='nome' id="nome" value=""></td>
<td><input class='linha1' id="idade" value=""></td>
<td><input class='linha1' id="funcao" value=""></td>
<td><input class='linha1' id="tempo" value=""></td>
</tr>
<tr>
<td>2</td>
<td><input class='nome' id="nome" value=""></td>
<td><input class='linha2' id="idade" value=""></td>
<td><input class='linha2' id="funcao" value=""></td>
<td><input class='linha2' id="tempo" value=""></td>
</tr>
<tr>
<td>3</td>
<td><input class='nome' id="nome" value=""></td>
<td><input class='linha3' id="idade" value=""></td>
<td><input class='linha3' id="funcao" value=""></td>
<td><input class='linha3' id="tempo" value=""></td>
</tr>
</table>
found what I needed https://api.jquery.com/each/ 

– cahm