textarea with syntax highlighting
function inputHandler(event) {
let code, inp;
// Clone text into pre immediately
// code = event.target.previousElementSibling.firstChild;
// if (!code) return;
inp = document.querySelector('#stack-input');
code = inp.previousElementSibling.firstChild;
code.textContent = inp.value
// Highlight the syntax
Prism.highlightElement(code); // , Prism.languages.javascript, 'javascript');
}
document.getElementById('stack-input').addEventListener('input', inputHandler);
document.getElementById('stack-input').addEventListener('focus', inputHandler);
window.addEventListener('load', inputHandler);