简单来说
1. button可以携带value值,并且在点击button时候,form提交会带上button的value
<button name="foo" value="bar" type="submit">Submit</button>
2. button带值可以有多个
<form action="/test-form" method="post"> <button name="_action" value="delete" type="submit">Delete</button> <button name="_action" value="disable" type="submit">Disable</button> </form>
3. 直接 new FormdData 不会携带button的value
const formdata = new FormData(form);
4. 使用 submitter 参数,可以指定提交某个button的value
form.addEventListener("submit", function (event) { event.preventDefault(); const formdata = new FormData(form, event.submitter); });
具体可参考 The submitter parameter for FormData
标签:form,FormData,value,event,参数,submitter,button From: https://www.cnblogs.com/mengff/p/17729871.html