Skip to content

Instantly share code, notes, and snippets.

@shaneriley
Created June 9, 2013 12:18
Show Gist options
  • Select an option

  • Save shaneriley/5743328 to your computer and use it in GitHub Desktop.

Select an option

Save shaneriley/5743328 to your computer and use it in GitHub Desktop.
$().serializeObject
$.fn.serializeObject = function() {
var obj = {};
if (!this.is("form")) { return this; }
this.find(":input").not("[disabled], :submit").each(function() {
obj[this.name] = isNaN(+this.value) ? this.value : +this.value;
});
return obj;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment