1
Good morning. I didn’t find anything similar in many posts so I decided to ask you: is it possible to change the value of a readonly field? For example, suppose you have two fields (number 1 and number 2) with values 3 and 3, and want to make their multiplication appear in a third readonly field with value 9 (result of this equation).
I made a code and I didn’t get any results. The theory is that one gets what is in the number field and, the user modifies, changes the result of the "value" field that shows the multiplication by 2. I can change the number field but my multiplication value field remains null.
<script>
let numero = document.getElementById("numero");
function valor() {
let novoValor = 2 * numero;
$("#valor").val('novoValor');
}
numeroKm.addEventListener('change', valor);
</script>
But if you are going to modify a field you should not declare it as readonly.
– anonimo
It is because this field is changeable as the person goes through a SELECT, with several options. Then when you arrive at this specific option, I made a number field appear and the result field was readonly.
– Gustavo S. Rocha
Wanted this readonly value to keep its property from being changed directly by the user, but changing its value according to the input on its side.
– Gustavo S. Rocha