JSFiddle - React, Tailwind, and code Playground

by r0k3t

HTML

<form id="yourform" action="destination.html">
    <label>feild 1</label>
    <input type="text" id="f1" value="" /><br/>
    <label>feild 2</label>
    <input type="text" id="f2" value="" /><br/>
    <label>feild 3</label>
    <input type="text" id="f3" value="" /><br/>
    <input type="submit" value="Go" />
</form>

JavaScript

$('#yourform').submit(function() {
    var qString = "";
    $('#yourform input[type=text]').each(function() { 
       qString += $(this).attr("id") + "=" + $(this).val() + "?"; 
    });
    console.log(qString);
    return false;
});