我想使文本框只读或不取决于个人贷款复选框的值。如果personalLoan复选框被选中,我希望文本不是只读的。如果未选中,我希望文本框是只读的。这里是行检查是否在td中使用jquery检查了特定的复选框
<tr id="mytableRows">
<td class="even"><input type="checkbox" value="true" name="homeLoan" ></td>
<td class="odd"><input type="checkbox" value="true" name="autoLoan" ></td>
<td class="even"><input type="checkbox" value="true" name="personalLoan" ></td>
<td class="odd"><input type="checkbox" value="true" name="noLoan" ></td>
<td class="odd"><input type="text" name="peronalAmount" value="1" readonly></td>
</tr>
我到目前为止有这个代码
$(document).ready(function(){
$('.test tr').click(function (event) {
$(this).find(':checkbox').each(function(p){
if($(this).attr('name') == 'personalLoan'){
if ($(this).is(':checked')) {
alert("checked");
}else{
alert("unchecked");
}
}
});
});
});
这告诉我复选框的当前状态,但我真正需要的是知道平变化的personalLoan复选框,所以我的一个可以使文本框只读或没有该行(TD)
感谢
[Make field readonly - checkbox - jQuery]可能的重复(http://stackoverflow.com/questions/7419383/make-field-readonly-checkbox-jquery) – Mathletics
[或其他类似帖子](http: //stackoverflow.com/search?q=make+checkbox+readonly) – Mathletics
这个问题“非常不同”的方式是什么? *如果*不同,请不要简单地告诉我们仔细阅读,*解释*差异。我们不是试图用报复的方式来回避你的问题,但我们可能会误解或简单地忽略差异。顺便说一句,我怀疑你的文本输入名称可能有拼写错误,“peronalLoan”应该是我个人认为的“personalLoan”吗? –