直接上代码
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());
}