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.
在原型中,有没有办法在使用查找后序列化页面上的所有“输入”元素$$?我必须处理一些没有任何表单或某些元素在表单之外的页面,因此不能使用 Form.serialize 或 Form.serializeElements。
$$
实际上,您可以Form.serialzeElements()在表单之外使用,您只需将元素列表传递给它。
Form.serialzeElements()
例如
HTML
<input type="text" name="a" id="a" value="12345" /> <input type="text" name="b" id="b" value="6789" />
Javascript
Form.serializeElements($$('input'))
返回
a=12345&b=6789
在这个 jsfiddle http://jsfiddle.net/av5Kj/中尝试一下