您现在的位置: 万盛学电脑网 >> 程序编程 >> 脚本专题 >> javascript >> 正文

jquery form表单序列化为对象的示例代码

作者:佚名    责任编辑:admin    更新时间:2022-06-22

 这篇文章主要介绍了jquery form表单序列化为对象具体实现,需要的朋友可以参考下

 代码如下: $.fn.serializeObject = function() {  var o = {};  var a = this.serializeArray();  $.each(a, function() {  if (o[this.name]) {  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;  }