I do not use jQuery, unless this will force me.
My apparently simple HTML document has a div with 3 inputs, the 3rd of which, for some reason, I fail to reset. My cleaned-up-for-display code appears below:
<div>
<label>LIMIT 1
<select id="limit1">
<option value="1">Choice1</option>
<option value="2">Choice2</option>
</select>
</label>
<label>LIMIT 2
<select id="limit2">
<option value="1">Choice1</option>
<option value="2">Choice2</option>
</select>
</label>
<label>ENTER A VALUE
<input type="text" id=“parm2” value="20" size="3" maxlength="4">
</label>
</div>
Here’s my validation and reset code:
var limit1 = document.getElementById("limit1");
var limit2 = document.getElementById("limit2");
if (limit2.value < limit1.value) {
alert("ERROR: 1st must be less than 2nd");
limit1.value = 1;
limit2.value = 2;
return false;
} // Above resets of select options works!
var uValue = document.getElementById(“parm2”).value;
if (isNaN(uValue)) {
uValue.value = "20"; // This reset fails!
return false;
}
Thanks for your help.