Last active
January 16, 2017 13:34
-
-
Save emanoelqueiroz/48c9dfaf5565c44adbb83deac34109dd to your computer and use it in GitHub Desktop.
Return an object with attributes referred by the fields name.
This file contains hidden or 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
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