【发布时间】:2019-06-18 08:20:17
【问题描述】:
我有一个输入<input type="text" value="1" readonly id='aaa'/>。
我想给它一个功能,当用户选中该框然后可以编辑id=aaa的值。
示例:
<input type="text" value="1" readonly/> <input type="checkbox" /> Checked this if you want to edit the value.
谢谢。
【问题讨论】:
-
为复选框提供适当的 ID 并使用以下代码: if($("#CheckboxId").is(":checked")) { $("#aaa").removeAttr("readonly "); }else{ $("#aaa").attr("readonly","readonly"); }