Last active
October 20, 2021 09:49
-
-
Save daanta-real/5ce48020447f5b8448dd64d6b988e8f1 to your computer and use it in GitHub Desktop.
Get all names and values of one form
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
// 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