JSFiddle - React, Tailwind, and code Playground

HTML

<form method="GET" target="_blank"    action="http://www.google.com/search">
    <input type="text">
    <button type="submit">Search</button>
</form>

JavaScript

$("input[type=text]").change(function() {
    var param = $("input[name=q]");
    if (param.length < 1) {
        param = $("<input type='hidden' name='q'>").appendTo($("form"));
    }
    param.val($(this).val());
});