Just dipping my toes into the world of JavaScript, so please be gentle!
I'm currently working on a function that multiplies one input field by another that the user provides. However, there seems to be an issue when the user wants to multiply by 8.5 - it only takes the integer value, not the decimal.
How can I ensure that the full number, including the decimal, is multiplied correctly?
Here's what my function looks like so far:
function calculate() {
amount = parseInt(document.getElementById("amount").value);
prev = parseInt(document.getElementById("previous").value);
result = amount * prev;
document.getElementById("return").value = result;
}
I've been searching for a solution online, but I'm struggling to find the right answer. Any help would be greatly appreciated!