gpt4 book ai didi

javascript - 在表行中选中复选框时启用文本框

转载 作者:行者123 更新时间:2023-11-28 16:12:05 24 4
gpt4 key购买 nike

我的submit.cshtml是:

<table id="scDetails" class="table">
<thead>
<tr>
<th>Item</th>
<th>IsChecked</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
@Html.EditorFor(m => m.Fbacks)
</tbody>
</table>

EditorTemplate 适用于 - @Html.EditorFor(m => m.Fbacks) (Fbacks.cshtml)

<tr>
<td>@Html.HiddenFor(m => m.Item)
@Html.DisplayFor(m => m.Item)
</td>
<td>@Html.CheckBoxFor(m => m.IsChecked)</td>
<td>@Html.TextBoxFor(m => m.Comment)</td>
</tr>

我需要的是:

当我选中该复选框时,应启用文本框,而取消选中时,应禁用文本框。

最佳答案

$("input[type='checkbox']").on("click", function() {
$(this).parent().next().find("textarea").prop("disabled", ! this.checked);
});

关于javascript - 在表行中选中复选框时启用文本框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12578252/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com