The intention is to put all the text inputs of the variable VesaoNova
Disable whenever the text input VersaoAntiga
is empty.
The problem is in jquery in conditions, how do I solve this?
<?php
while($row = mysqli_fetch_array($result))
{
echo "<tbody data-link='row' class='rowlink'>";
echo "<tr>";
echo "<td>" . $row['Opcao'] . "</td>";
echo "<td> <input type='text' name='VersaoAntiga' id= 'VersaoAntiga-".$row['IDOpcao']."' class='form-control'></td>";
echo "<td> <input type='text' id='VersaoNova-".$row['IDOpcao']."' name='VersaoNova' class='form-control'></td>";
echo "<td style='text-align:center;'><input type='checkbox' name= 'VerificacaoPrevia'></td>";
echo "<td style='text-align:center;'> <input type='checkbox' name='VerificacaoNova'></td>";
echo "</tr>";
echo "</tbody>";
}
echo "</table>";
mysqli_close($conn);
?>
<script>
$(document).ready(function(e){
var id = e.target.id.split("-");
$('#VersaoNova-'+id[1]).prop('disabled',true);
if (id[0]=="VersaoAntiga") {
$('#VersaoAntiga-'+id[1]).keyup(function(){
$('#VersaoNova-'+id[1]).prop('disabled', this.value == "" ? true : false);
})
}
});
</script>