Javascript 获取多个form表单数据第三方:
form-serialize
具体使用:
<form id="example-form">
<label for="username">用户名:</label>
<input type="text" name="username" value="shiwensong" /> <br />
<label for="username">密码:</label>
<input type="password" name="password" value="12345678" /><br />
</form>
<button>提交</button>
<script src="./form-serialize.js"></script>
<script>
document.querySelector("button").addEventListener("click", function (event) {
var form = document.querySelector('#example-form');
var obj = serialize(form, { hash: true, empty: true });
console.log(obj)
})
</script>