I'm currently working on a JavaScript program that aims to update the value of a hidden input field.
However, I am facing an issue where a specific value is being changed too frequently. To address this, I have attempted using the following method to store the previous value:
<input type="hidden" value="" id="test">
<script>
alert(document.getElementById('test').value);
document.getElementById('test').innerHTML=10;
alert(document.getElementById('test'));
</script>
The problem is that '10' is not being stored. How can I fix this issue? My main objective is to simultaneously keep track of the previous value (as well as the last 'n' values changed) and the updated value. If there are alternative methods to achieve this goal, I would greatly appreciate any suggestions.