似乎默认禁用的输入元素被 $.serialize()
忽略。有解决方法吗?
最佳答案
暂时启用它们。
var myform = $('#myform');
// Find disabled inputs, and remove the "disabled" attribute
var disabled = myform.find(':input:disabled').removeAttr('disabled');
// serialize the form
var serialized = myform.serialize();
// re-disabled the set of inputs that you previously enabled
disabled.attr('disabled','disabled');
关于jquery - 我如何使 $.serialize() 考虑到那些禁用的 :input elements?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4748655/