<button onclick="changefigure()">2011</button>
<figure>
<img id="Image" src="NT_Naplan_Reading_Results_2017.png"/>
<figcaption id="caption"><em>Fig 2</em>Percent of children above national minimum standard in
reading in 2017 for Year 3, 5, 7 and 9 for Non-Indigenous and Indigenous children in the
Northern Territory. Data Source <a href="">NAPLAN results</a></figcaption>
</figure>
<script>
function changefigure()
{
var x = document.getElementById("Image");
var y = document.getElementById("caption")
x.src = 'NT_Naplan_Reading_Results_2011.png'
//y = "<em>Fig 1</em>Percent of children above national minimum standard in reading in
2017 for Year 3, 5, 7 and 9 for Non-Indigenous and Indigenous children in the Northern
Territory. Data Source <a href="">NAPLAN results</a>"
}
</script>
So I can't seem to be able to change the figcaption. I've tried using y.innerHTML and y.innertext but both of them dont seem to work. Any tips?