序列化表单的字段集内容
这是我的代码: http://jsfiddle.net/michelejs/Pt6LQ/25/
我将仅序列化字段集名称= cap1。
所以我尝试修改
$('#result').text(JSON.stringify($('form').serializeObject()));
,
$('#result').text(JSON.stringify($('fieldset#cap1').serializeObject()));
但它不起作用并返回我{}。 如何修改代码以仅序列化一个字段集内容而不是所有表单?
多谢。
this is my code: http://jsfiddle.net/michelejs/Pt6LQ/25/
I would to serialize only the fieldset name= cap1.
So I tried to modify
$('#result').text(JSON.stringify($('form').serializeObject()));
in
$('#result').text(JSON.stringify($('fieldset#cap1').serializeObject()));
but it doesn't work and return me {}.
How can I modify the code for serialize only one fieldset content and not all the form?
Thanks a lot.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该使用:
更新的小提琴:
http://jsfiddle.net/Pt6LQ/26/
You should use:
updated fiddle:
http://jsfiddle.net/Pt6LQ/26/
当你使用 #cap1 时,它应该是 id 而不是 name
as you use #cap1, it should be id instead of name