$('input[name=username]').attr("readonly","readonly")//将input元素设置为readonly $('input[name=username]').removeAttr("readonly");//去除input元素的readonly属性