有2个解决方案:
in your css you can add this:
.input-disabled{background-color:#EBEBE4;border:1px solid #ABADB3;padding:2px 1px;}
in your js do something like this:
$('#test').attr('readonly', true);
$('#test').addClass('input-disabled');
希望能有所帮助。
另一种方法是使用一些评论中提到的隐藏输入字段。但是请记住,在后端代码中,您需要确保在正确的情况下验证此新隐藏的输入。因此,我不推荐这种方式,因为如果处理不当,它将创建更多错误。