Hidden checkbox values are not included in jQuery .serialize()

て烟熏妆下的殇ゞ 提交于 2019-12-13 06:59:13

问题


I am using the jQuery plugin "DataTables" which helps me display large paginated tables of data including many rows with checkboxes. All works as expected in Chrome, but in IE8 when I serialize the DataTable form containing checkboxes, only the checkboxes that are visiable are serialized. In Datatables, the paginations allows you to select checkboxes and move to a different page of results (say 11-19 instead of 1-9) yet maintain the selection previously made on a different page of results.

When I use $("#theForm").serialize() in a $.post call, only the visible checkboxes are included. This is not the case in Chrome where the entire list of selected checkboxes including hidden checkboxes are found with .serialize().

This situation seems like it must have happened before to other people, let me know if there is a solution! Thanks!


回答1:


The solution was to unhide the checkboxes serialize, and re-hide them. This does not result in a bunch of checkboxes appearing and disappearing because it happens so fast.



来源:https://stackoverflow.com/questions/13870463/hidden-checkbox-values-are-not-included-in-jquery-serialize

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!