Iam trying to do a calculation. When a user selects a dropdown currency. The system calculates and converts the selected currency from the dropdown to INR currency values. The records are coming from mysql db and the record count will be from one record to 300 records. Here the user needs to change each currency from the drop down and the system converts this selected currency value to INR value. Its really a hectic task. So If the user changes one currency value from dropdown, the system should change the entire row currency value to the selected dropdown value and the system should calculate on certain formulae to change the value to INR. All these is working fine.
Now the issue iam facing is to implement the formulae to the jquery.
Here is the fiddle what i have done:
Fiddle
If you can check the fiddle in the jquery part i have used a formula
var newTotal = currency==="INR" ? totalINR : (totalINR * conversionRate / row.find('.inrvalue').val()).toFixed(3);
This above formula wrong:
The actual formula iam looking at is
if (currency==="INR")
{
var newTotal = totalINR;
} else if (currency==="USD")
{
var newTotal = (row.find('.total1.').val() * row.find('.inrvalue').val());
} else {
var newTotal = ((row.find('.inrvalue').val() / conversionRate) * row.find('.total1.').val());
}
How will i change the existing formulae to this? When i implement this formula, iam getting an error Uncaught Error: Syntax error, unrecognized expression: .. Help Appreciated