I have a counter for button clicks, but if I refresh the page it sets back to '0'
. How can I storage the input value so if I close the browser the previous number will remain still?
$(function() {
$('.counter').click(function() {
$(this).val(parseInt($(this).val()) + 1);
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="button" class="counter" value="0">