Created
August 28, 2015 11:22
-
-
Save DanWebb/9e53b7ff283dd412a5bd to your computer and use it in GitHub Desktop.
Revisions
-
DanWebb created this gist
Aug 28, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ var obj = {}; $('form').find('input, select, textarea').each(function() { obj[this.name] = this.value; }); // Or create an object based on a specific group of form elements var address = {}; $('form').find('[name^="address"]').each(function() { address[this.name.replace('address[','').replace(']','')] = this.value; });