<div id="div1">
<input class="int" type="text" value="haodongxi"/>
<button class="btn">修改只读属性</button>
</div><script type="text/javascript">
$("#div1").on("click",".btn",function(){
if($(".int").attr("readonly")=="readonly"){
$("input[type=text]").removeAttr("readonly");
}else{
$("input[type=text]").attr("readonly","readonly");
}
})
</script>
效果就能实现了