Skip to content

Instantly share code, notes, and snippets.

@Yuffster
Created September 10, 2008 03:49
Show Gist options
  • Save Yuffster/9817 to your computer and use it in GitHub Desktop.
Save Yuffster/9817 to your computer and use it in GitHub Desktop.
Element.implement({
/* Adds a getArguments method to Elements that will extract the "arguments" of
forms. */
getArguments: function(){
var obj = {};
this.getElements('input, select, textarea', true).each(function(el){
var name = el.name, type = el.type, value = el.value;
if (value === false || !name || el.disabled) return;
$splat(value).each(function(val){ obj[name] = val; });
}); return obj;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment