JSFiddle - React, Tailwind, and code Playground

HTML

<form action="#">
  <input id ="q" name="q" type="text" size="30" value="foo;alert('xss')">
  <input type="submit">
</form>

JavaScript

function fire() {
el = document.getElementById("q");
val = el.value;
eval("foo = " + val + ";");
}

var foo = "";

fire();