jQuery控制 input 不可编辑
作者:互联网
直接上代码
function disabledinput(){
if($("#input1").attr("disabled") == "disabled"){
$("#input1").removeAttr("disabled");
}else{
$("#input1").attr("disabled","disabled");
}
console.log($("#input1").val());
}
function readonly(){
var readonly = $('#input2').attr('readonly');
console.log("readonly:"+readonly);
if(readonly == "readonly"){
$('#input2').removeAttr("readonly");
}else{
$('#input2').attr('readonly','readonly');
}
console.log($("#input2").val());
}
标签:jQuery,input2,input1,console,attr,disabled,编辑,readonly,input 来源: https://www.cnblogs.com/scyitgz/p/13164373.html