Created
October 4, 2012 23:51
-
-
Save madhums/3837191 to your computer and use it in GitHub Desktop.
jquery form serialize hash
This file contains 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 characters
var serializeHash = function () { | |
var attrs = {}; | |
$.each($(this).serializeArray(), function(i, field) { | |
attrs[field.name] = field.value; | |
}); | |
return attrs; | |
}; | |
$.fn.extend({ serializeHash: serializeHash }); | |
// usage | |
$('form').serializeHash(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does work for simpler forms. Thank you good sir.