Given this very simple framework, what are some approaches to replacing the word-list navigation of the innerHTML content with prev/next buttons? I have tried to implement nextElementSibling - if that's the best solution - but it's over my head.
If it makes a difference, I do want to eventually replace the innerHTML content with fairly complex formatted html blocks, but I would like to understand a simple solution that can accomodate very simple content like this in any case. Many thanks for your assistance.
function first() {
document.getElementById("content").innerHTML = "dog";
}
function second() {
document.getElementById("content").innerHTML = "cat";
}
function third() {
document.getElementById("content").innerHTML = "fish";
}
body {
font-size: 30px;
padding: 30px;
line-height: 2em;
}
<div id="content"></div>
<span onclick="first()">first</span>
<span onclick="second()">second</span>
<span onclick="third()">third</span>