JSFiddle - React, Tailwind, and code Playground

by kentaromiura

HTML

<form id="form">
<input type="text" name="foo"/>
<input type="text" name="baz" />
</form>

JavaScript

String.implement({
    fillForm: function(formID){
        Object.forEach(this.parseQueryString(), function(value, prop){
           var target = formID? '#'+formID : 'body';
           $$(target+' input[name='+prop+']').set('value',value); 
        });
    }
});
    
//"foo=bar&baz=cpojer".fillForm();
"foo=bar&baz=cpojer".fillForm('form');