// Change the buttons text back to ‘Show code’
document.querySelector('#' + parentElement + ‘.code-show-button’).value = “Show code”;
// Remove the ‘open’ div from the parent
parentElementDiv.classList.remove(‘open’);
If we now put this all back together, we end up with this: