I am doing something wrong.
html:
Quantity: <input type = "text" id ="quantc" name = "quantWash" size = "5" tabindex = "13" onblur="calcRowWash()"/><br> Wash Total: <input type = "text" id ="totc" name = "washtotal" size = "5" tabindex = "14" value=""/>
js:
calcRowWash = (function(){
var x = document.getElementById("quantc");
if(x == "2"){
document.getElementById("totc").value = 1000;
}else{
document.getElementById("totc").value = 100;
}
});
Advertisement
Answer
There you go, it is working now. As mentioned by Alon, you were comparing the element itself (#quantc) instead of its value
calcRowWash = (function(){
var x = document.getElementById("quantc").value;
if(x == "2"){
document.getElementById("totc").value = 1000;
}else{
document.getElementById("totc").value = 100;
}
});Quantity: <input type = "text" id ="quantc" name = "quantWash" size = "5" tabindex = "13" onblur="calcRowWash()"/><br> Wash Total: <input type = "text" id ="totc" name = "washtotal" size = "5" tabindex = "14" value=""/>