I have an input text box for search of input, the id of the text box is: id="search".
if a user enters 'cat' at first and hit search.
In the function, I get the value 'cat' by using the syntax:
var input = document.getElementById("search").value;
After that, the user enter 'dog' in the search box and hit search using the same function.
The function would assign 'dog' to the input variable.
How would I compare the current value (dog) to the previously entered value (cat)?
I have tried to assign the original input with a statement, something like
var orig = input;
but that would only overwrite the original input with the new input.
What is the logical approach to this problem.