Can live user input be captured in a liquid theme text field?

Without using React, is it possible to capture user input live in a text field and display it as a h1 or such in a liquid theme?

Don’t need React for that, it can be done with native JS

As an example, this can be your HTML

# This will change

And this can be your JS

function doMagic(text) {
	var x = document.getElementById("magic");
  x.innerText = text;
}

See it in action here

https://jsfiddle.net/fiddler2021/b9nf8sq1/7/

Cool Thanks, so if I were to incorporate this on my shopify website, where would I put the function?