首页 > 其他 > 详细

序列化问题

时间:2018-10-09 11:29:26      阅读:168      评论:0      收藏:0      [点我收藏+]
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();

 

序列化问题

原文:https://www.cnblogs.com/beimingbingpo/p/9759234.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!