$.fn.serializeObject = function()
{
var o = {};
var a = this.serializeArray();
$.each(a, function() {
if (o[this.name] !== undefined) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});
return o;
};
jquery读取表单数据: serializeArray & serializeObject
最新推荐文章于 2022-04-23 16:14:35 发布
本文深入探讨了jQuery中$.fn.serializeObject函数的功能和用法,解析如何将表单元素序列化为对象。
8752

被折叠的 条评论
为什么被折叠?



