<li><a href="/chapter-1.html">Ch. 1 - TitleHere</a></li>
<li><a href="/chapter-2.html">Ch. 2 - TitleHere</a></li>
<li><a href="/chapter-3.html">Ch. 3 - TitleHere</a></li>
<li><a href="/chapter-4.html">Ch. 4 - TitleHere</a></li>
<li><a href="/chapter-5.html">Ch. 5 - TitleHere</a></li>
These links lead to various static pages on my website, each identified by a number in the URL.
I am now looking to create buttons that link to the next and previous pages by adjusting the numbers in the URLs accordingly. However, I am struggling to find a way to target these numbers within the href attribute.
For now, I am simply setting up an alert function.
<button type="button" onclick="getURL();">Get Page URL</button>
<script>
var current = window.location.pathname;
function getURL() {
alert(current + 1);
}
</script>