8610

by rwaldron

HTML

<form id="testform">
     <input type ="text" name="something" value="12" />
     <input type ="text" name="somethingmore" value="13" />
     <input type ="text" name="somethingelse" value="14" />
</form>
<div id="out"></div>

JavaScript

$('#out').html(JSON.stringify($('#testform').serializeArray()));
$('#testform').append($('<input id="test" type="text" class="cosAttribute" name="test" />'));
console.log(JSON.stringify($('#testform').serializeArray()));



var str = ""; 

$.each($('#testform *'), function (i, o) {

str += o.name + "=" + o.value + "|";

});

console.log(str)