Skip to content

Instantly share code, notes, and snippets.

View nrioux's full-sized avatar

Nick Rioux nrioux

  • University of Pennsylvania
  • Philadelphia
View GitHub Profile

Keybase proof

I hereby claim:

  • I am nrioux on github.
  • I am nrioux (https://keybase.io/nrioux) on keybase.
  • I have a public key whose fingerprint is 2D14 686B 5EA9 3F74 85D6 2FE4 89A1 5435 CCE5 753F

To claim this, I am signing this object:

@nrioux
nrioux / formData.js
Created August 19, 2012 16:59
Convert form data to object with jQuery
(function($) {
$.fn.formData = function(this) {
var input = "input[name], select[name], textarea[name]";
if(this.is(input)) {
if(this.is("input[type='checkbox'], input[type='radio']")
return this.is(":checked") ? this.val() : undefined;
else if(this.is("input[type='number']"))
return Number(this.val());
else
return this.val();