JSFiddle - React, Tailwind, and code Playground
HTML
<form>
<select name="selecty">
<option value="s1">t1</option>
<option value="s2" selected>t2</option>
<option value="s3">t3</option>
</select>
<input type="text" name="texty" value="yep" />
<input type="radio" name="rad" value="r1" />
<input type="radio" name="rad" value="r2" checked />
<input type="radio" name="rad" value="r3" />
<input type="radio" name="rad" value="r4" />
<input type="checkbox" name="checky" value="c1" checked />
<input type="checkbox" name="checky" value="c2" checked />
<input type="checkbox" name="checky" value="c3" />
<input type="checkbox" name="checky" value="c4" checked />
</form>
JavaScript
(function($,undefined){
'$:nomunge'; // Used by YUI compressor.
$.fn.serializeObject = function(){
var obj = {};
$.each( this.serializeArray(), function(i,o){
var n = o.name,
v = o.value;
obj[n] = obj[n] === undefined ? v
: $.isArray( obj[n] ) ? obj[n].concat( v )
: [ obj[n], v ];
});
return obj;
};
})(jQuery);
console.log($("form").serializeObject());
console.log($("form").serialize());