I have an input type= text that I take the value of to compare to another know value. When the user enters an integer or floating point number it works great. However, if the user enters a calculation say 12/297 or 12 + 9 I would like to perform the calculation and then compare the result to a known value. Any suggestions on how I would do this.
The input field is simply
<input type="text" id="A1">
The code that is getting the value as a float is:
parseFloat(document.getElementById("A1").value
I have tried just taking the value as a string and attempting to manipulate it but no luck. Also I tried tried parsing as a string on the operation sign and then applying the operation to each part of the string but that is a huge amount of work for a tiny issue so there has got to be a better solution.
Thanks