html的代码 <div class="control-group">
<label class="control-label required"> <span
class="help-inline"><font color="red">*</font> </span>房间总数:
</label>
<div class="controls">
<input type="text" name="count" id="quantity1"
style="width: 30px;" onchange="totalRooms(1)"
onkeyup="this.value=this.value.replace(/[^\d]/g,'') "
value=""
readOnly="true"/> 间 <input class="btn btn-primary" type="button" value="修改总数"
onclick="editCount(1)" />
</div>
</div>
js
<script type="text/javascript">
function editCount(i) {
//$("#quantity"+i).setAttribute("readOnly", false);
//$("#quantity"+i).readOnly=false;
$("#quantity"+i).removeProp("readOnly");
} </script>
注释的前两种不可用,不知道原因,最后的removeProp可用
input输入框隐藏
<span >
<input value="${roomTypeList }" name="type" style="display:none;"/>
<input value="${str }" name="str" style="display:none;"/>
</span>