I have the following code which when a button is clicked checks to see the previous value stored and concatenates it with the new value - essentially to get a long list of latitudes and longitudes.
(arrayvalues is declared globally)
var previousvalues = document.getElementsByName('arrayvalues')[0].value
arrayvalues = previousvalues + latitude+ "," + longitude+"##";
//alert(arrayvalues);
document.getElementById("arrayvalues").value = arrayvalues;
The document.getElementById stores the new value here:
<input type="text" value="" name="arrayvalues" id="arrayvalues" />
However the issue I am having is the user can at any point undo their last click meaning the last latitude and longitude values stored need removing. How can I go about doing this the way I have coded it?