0
If it type 1, I have to check that in the table there is no value 1 that has already been typed, if there is the repeated value, remove the value 1 and keep the other intact. So for other values.
HTML
<table>
<tr>
<td><input type="text" name="notapergunta2_1" placeholder="Alfa"/> Alfa</td>
<td><input type="text" name="notapergunta2_2" placeholder="Chub"/> Chub</td>
<td><input type="text" name="notapergunta2_3" placeholder="Met "/> Met </td>
</tr>
<tr>
<td><input type="text" name="notapergunta2_4" placeholder="A"/> A</td>
<td><input type="text" name="notapergunta2_5" placeholder="G"/> G</td>
<td><input type="text" name="notapergunta2_6" placeholder="N"/> N</td>
</tr>
<tr>
<td><input type="text" name="notapergunta2_7" placeholder="ASS"/> ASS</td>
<td><input type="text" name="notapergunta2_8" placeholder="Hdi"/> Hdi</td>
<td><input type="text" name="notapergunta2_9" placeholder="Porto"/> Porto </td>
</tr>
</table>
my javascript:
array = []
for(var i = 0; i<9;i++){
var numeroDaPergunta = i+1;
$("[name='notapergunta2_"+numeroDaPergunta+"']").on("change",function(){
var verificaValorDigitado = $(this).val();
if(verificaValorDigitado > 3 || verificaValorDigitado <= 0){
alert("Valor Digitado : "+verificaValorDigitado+"\nDigite Números de 1 a 3");
$(this).val("");
} else {
array.push($(this).val());
for(var j = 0; j<array.length; j++){
if(verificaValorDigitado == array[j]){
alert("Valor Repetido");
$(this).val("");
return false;
}
}
}
});
}
I’m not finding a solution, could help me?
What repeated values do you want to remove? It could detail the question better?
– Felipe Avelar
If it type 1, I have to check that in the table there is no value 1 that has already been typed, if there is a repeated value, remove the value 1 and keep the other one intact. so for other values.
– chocolatemontana
is a repeat list for each field or for all Fields?
– Guilherme Nascimento
all text inputs are empty, if I type 1 I must check in all text inputs of the table if there is this value, if there is one, I must remove this last repeated value and keep the other.
– chocolatemontana