Zaczynam JavaScript, napisałem tę funkcję:Jak wyłączyć pole wejściowe za pomocą JavaScript?
function disableField() {
if(document.getElementById("valorFinal").length > 0)) {
document.getElementById("cantidadCopias").disabled = true;
}
}
co wyłącza drugie pole o nazwie cantidadCopias jeśli pierwszy jest wypełniony.
<label> <span>Valor final:</span>
<input type="text" class="input_text" name="valorFinal" id="valorFinal" onkeydown="disableField()"/>
</label>
<label> <span>Cantidad de Copias:</span>
<input type="text" class="input_text" name="cantidadCopias" id="cantidadCopias"/>
</label>
Ale nie wyłącza drugiego pola, gdy pierwszy jest wypełniony.
pan zapomniał powiedzieć nam, gdzie jest twój problem. Jakie jest twoje pytanie? – feeela
Ktoś ma problem z pisownią document.getElementById ("valorFinal") Długość <- length – epascarello
Niestety, edytowałem pytanie. – JorgeeFG