Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的表单中有一个输入文本字段,其中有一个通过 JavaScript 添加的重要新属性。属性名称是fieldid。
fieldid
有没有办法在表单登顶后从视图中检索此属性及其值?
提交表单时,表单元素的属性不会传递给服务器;只有输入元素值是。
在表单提交时添加额外信息以发送回服务器的方法是向表单添加额外<input />的元素,特别是<input type="hidden" />元素。
<input />
<input type="hidden" />
例如
<input type="hidden" name="foobar" value="spam and eggs" />
foobar使用 value 向表单数据添加一个新字段spam and eggs。
foobar
spam and eggs