I have this html code:
<input type="radio" name="resultado" value="Y" onclick="habilitaCampo(this.value)">Aprovado
<input type="radio" name="resultado" value="N" onclick="habilitaCampo(this.value)">Recusado<br>
<input type="text" id="data_validade" name="data_validade" size="15" maxlength="10" disabled="disabled" onKeyPress="mascara_data(this,event);"/>
And the javascript function:
function habilitaCampo(valor){
if(valor == "Y"){
document.getElementById("data_validade").disabled = false;
document.getElementById("data_validade").focus();
}
else{
document.getElementById("data_validade").disabled = true;
}
}
to enable or disable the data_value field. But I wanted to pass the field id as a parameter and use this function in other fields, since I am creating several functions that are unnecessary, and I can not pass and receive the value correctly. Can you help me with this?