标签:serialize == code _id 问题 UNC property temp fun
serialize()对于未选中的checkbox,radio是获取不到值得。
$.fn.all_serialize = function () { var a = this.serializeArray(); var $radio = $(‘input[type=radio],input[type=checkbox]‘, this); var temp = {}; $.each($radio, function () { if (!temp.hasOwnProperty(this.name)) { if ($("input[name=‘" + this.name + "‘]:checked").length == 0) { temp[this.name] = ""; a.push({name: this.name, value:0}); } } }); return a; }; $("#form_id").all_serialize();
标签:serialize == code _id 问题 UNC property temp fun
原文地址:https://www.cnblogs.com/beimingbingpo/p/9759234.html