1
How do I, the user enter the values in 02 fields the result of this sum automatically appear in the Final Value field[]? These fields are coming from the database.
while($peListar = mysqli_fetch_object($sqlListar){
.....
$listar .= "<td style='".$fundo."'><input type='text' name='ValorI[]' class='md-form-control' value=''></td>";
$listar .= "<td style='".$fundo."'><input type='text' name='ValorII[]' class='md-form-control' value=''></td>";
$listar .= "<td style='".$fundo."'><input type='text' name='ValorFinal[]' class='md-form-control' value=''></td>";
.....
}
Hello dvd, it worked the way it went, but forgive me, I forgot to mention a detail. The total value of the sum will be divided by 2 I put it as follows: (value1+value2)/2, but he only calculated the first field.
– user24136
Put it like this:
$("[name='ValorFinal[]']", parent).val((valor1+valor2)/2);
the result will be, for example:valor1 = 100
+valor2 = 60
, summing up =160
, divided by2
, outworking =80
.– Sam
Sorry again dvd, it worked yes. It was a mistake of mine here. Thank you
– user24136