How can I add readonly to a specific <input> ?(如何将readonly添加到特定的<input> ?)
readonly
<input>
.attr('readonly')
jQuery <1.9(jQuery <1.9)
$('#inputId').attr('readonly', true);
jQuery 1.9+(jQuery 1.9+)
$('#inputId').prop('readonly', true);
Read more about difference between prop and attr(阅读有关prop和attr之间差异的更多信息)
2.1m questions
2.1m answers
60 comments
56.8k users