The user sets through the field an inequality, i.e. 50<A, X>30, 50<C<100
. This is stored through javascript function on button click.
My issue is, the field doesn't work in a specific case when there's a "less than" symbol followed by a letter. So, it will store fine e.g. X>30, A<50, but NOT 50<A or 50<C<100
. In both of the latter cases it just shows the first number, meaning it's having trouble with the pattern "less than followed by letter", as this is simply omitted. How do I make it work?
Here's my code (php):
echo "<input type=\"text\" id=\"equation\">";
echo "<button onclick=\"addEq()\">Add</button>";
And javascript part (basically appends all equations entered, separated by ":")
var addEq = function() {
eq = document.getElementById("equation").value;
if (document.getElementById("equation").innerHTML == "") {
document.getElementById("equation").innerHTML = eq;}
else {
document.getElementById("equation").innerHTML += ":" + eq;}}