gpt4 book ai didi

jquery - 我如何使 $.serialize() 考虑到那些禁用的 :input elements?

转载 作者:IT王子 更新时间:2023-10-29 03:24:32 24 4
gpt4 key购买 nike

似乎默认禁用的输入元素被 $.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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com