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

时间:2014-03-05    点击:69   
复制代码 代码如下:

$.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;
}
100个不能错过的实用JS自定义函数
jQuery DOM操作实例
JS父页面与子页面相互传值方法
JS和函数式语言的三特性
jquery 使用简明教程
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved