I have the following HTML with a value of “1-99” visible:
<ul class="controls-buttons question-controls">
<li>
<a href="#" title="Previous" id="orderPrevious><img src="/Images/control-double-180.png"></a>
</li>
<li>
<a id="orderRange">1 - 99</a>
</li>
<li>
<a href="#" title="Next" id="orderNext"><img src="/Images/control-double.png"></a>
</li>
</ul>
Is there a way that I can have the orderRange change so it changes like this when the previous and next links are clicked? Ideally I would like some way that doesn’t mean I have to hardcode a lot of if and else statements.
1-99 > 100-199
1-99 < 100-199 > 200-299
100-199 < 200-299 > 300-399
200-299 < 300-399
etc ..
Once changed I would like to store the value using local storage like below:
var store = window.localStorage;
store.setItem('Range', xxx)
I hope someone can help me.
Here’s a solution :
Demonstration