I am currently creating an order form. However, I have been stuck at the value obtaining.
It is a product order form, I want to display price and calculate the amount by users’ choosing.
For example, I got a product quantity drop down list, so when the user chooses one product, the price div will display one value, if the user chooses 0, the price div will display $0. Where is the problem?
var productValue = document.getElementById("e_Product");
var productQuantity = document.getElementById("e_Quantity");
var stringValue = productValue.options[productValue.selectedIndex].text;
if (stringValue == "Product Name" && productQuantity == 1)
{
var singleValue = "$800.00";
$('#e_Price').val(singleValue);
}
else
{
var singleValue1 = "$0.00";
$('#e_Price').val(singleValue1);
}
Also, in a form, how to disable the edit function to the input fields? I found when I obtain the value for those product, the user still can type whatever they want in the fields.
For displaying values in input fields, I feel that i can only use val() to output the value, so everytime I need to set a new variable to hold the value, but for the order form, I want to add a calculation function at the end. Like the user chooses the product, product quantity and the shipping options, I need to get the amount of all those fees.
Sorry about the expression, a little bit mess, several questions are put together, kinda have no idea what I am doing.
Thank you guys very much in advance.
Use global variable
For disable textbox (total amount field)
or