Skip to content

Instantly share code, notes, and snippets.

@daanta-real
Last active October 20, 2021 09:49
Show Gist options
  • Save daanta-real/5ce48020447f5b8448dd64d6b988e8f1 to your computer and use it in GitHub Desktop.
Save daanta-real/5ce48020447f5b8448dd64d6b988e8f1 to your computer and use it in GitHub Desktop.
Get all names and values of one form
// Get the names & values of one specific form by the name in the page
// limitations: can be used only for simple form (no relation with other tags)
// 특정 이름의 form 내역 출력
function showFormStr(name) {
var str = "";
document.forms[name].childNodes.forEach((el) => {
if(el.name !== undefined && el.name.length > 0) str += el.name + " = " + el.value + "\n";
});
console.log(str);
}
showFormStr("inputs");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment