如何通过单击复选框连续启用文本框 [英] How to enable the text boxes in a row by clicking on check box

查看:78
本文介绍了如何通过单击复选框连续启用文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我写了一个html代码来显示禁用模式下的表格信息。但如果我点击复选框/框,那些选中的行/行应该处于可编辑模式。





i wrote a html code to display the table information in disable mode. but if i click on the check box/boxes, those checked row/rows should be in editable mode.

<tbody>
                        
                          @foreach(StudentsEnquire enqire in Model.StudentEnquire)
                          {
                              <tr>
                                  <td>@Html.CheckBox("status"+enqire.StudentId, new { value = enqire.StudentId, @class = "EnquireCheckBox" })</td>
                                  <td>@Html.TextBox(enqire.SName, enqire.SName, new { @class = "textdisable", @disabled = "disabled" })</td>
                                  <td>@Html.TextBox(enqire.SCourse, enqire.SCourse, new { @class = "textdisable", @disabled = "disabled" })</td>
                                  <td>@Html.TextBox(enqire.SQualification, enqire.SQualification, new { @class = "textdisable", @disabled = "disabled" })</td>
                                  <td>@Html.TextBox(enqire.SContact, enqire.SContact, new { @class = "textdisable", @disabled = "disabled" })</td>
                                  <td>@Html.TextBox(enqire.email, enqire.email, new { @class = "textdisable", @disabled = "disabled" })</td>
                                  <td>@Html.TextBox(enqire.SAddress, enqire.SAddress, new { @class = "textdisable", @disabled = "disabled" })</td>
                                  <td>@Html.TextBox(enqire.Remarks, enqire.Remarks, new { @class = "textdisable", @disabled = "disabled" })</td>
                              </tr>
                          }
                        
                    </tbody>





jquery code :





jquery code:

$('.EnquireCheckBox').click(function () {


       var result = $('input[type="checkbok"]:checked').closest('tr').children();

       if ($(this).prop("checked") == true) {
           $('.textdisable').prop('disabled', false);
         var value = $(this).val();

                   }

       else if ($(this).prop("checked") == false) {


       }

   });





这个jquery代码启用所有未检查的文本框



我尝试了什么:



i编写了一个html代码,用于在禁用模式下显示表信息。但如果我点击复选框/框,那些选中的行/行应该处于可编辑模式。



这个jquery代码启用所有不是的文本框检查



this jquery code is enabling all the text boxes which are not checked also

What I have tried:

i wrote a html code to display the table information in disable mode. but if i click on the check box/boxes, those checked row/rows should be in editable mode.

this jquery code is enabling all the text boxes which are not checked also

推荐答案

' 。EnquireCheckBox')。click( function (){


var result =
('.EnquireCheckBox').click(function () { var result =


' input [type =checkbok]:已选中')。nearest(' tr')。children();

if
('input[type="checkbok"]:checked').closest('tr').children(); if (


this )。 ( 选中)== true ){
(this).prop("checked") == true) {


这篇关于如何通过单击复选框连续启用文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆