Skip to content

Instantly share code, notes, and snippets.

@emanoelqueiroz
Last active January 16, 2017 13:34
Show Gist options
  • Save emanoelqueiroz/48c9dfaf5565c44adbb83deac34109dd to your computer and use it in GitHub Desktop.
Save emanoelqueiroz/48c9dfaf5565c44adbb83deac34109dd to your computer and use it in GitHub Desktop.
Return an object with attributes referred by the fields name.
function makeObj($form) {
let obj = {};
$form.find("input, select, textarea").each(
(key, ele) => {
if (ele.name)
obj[ele.name] = null;
});
return obj;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment