萬盛學電腦網

 萬盛學電腦網 >> 腳本專題 >> javascript >> jquery form表單序列化為對象的示例代碼

jquery form表單序列化為對象的示例代碼

 這篇文章主要介紹了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;  }   
copyright © 萬盛學電腦網 all rights reserved