I have this simple form:
<form align="center" onload="chk()" name="form" action="" method="post" id="form">
<input type="text" name="quantt" id="quantt" value="">
<input type="text" name="avail" id="avail" value="">
</form>
the "avail" input is auto-filled from a php script. My question is How can I hide or disable the "quantt" input if the "avail" value is empty on loading of the form ?
I've tried this function but it didn't work :-(
function chk() {
var ava = document.form.avail;
if (ava.value == "") {
document.getElementById("quantt").type = "hidden";
} else {
document.getElementById("quantt").type = "text";
}
}
Thank you so much for any help.