Enable Disable Controls in a table row

前端 未结 3 1533
挽巷
挽巷 2021-01-19 17:36

I would like to enable the edit&delete checkboxes of that row, when the respective chkView is checked and disable them if it is unchecked. This code is not firing at all

3条回答
  •  清酒与你
    2021-01-19 18:39

    $(document).on('change','.chkView',function(){
    var row = $(this).closest('tr');
        if($(this).is(':checked'))
        {           
          $(row).find('.chkEdit,.chkDelete').prop("disabled",false);    
        }
        else
        {
          $(row).find('.chkEdit,.chkDelete').prop("disabled",true);     
        }
    });
    

    You are missing '.' in the selector class.

    Demo:

    http://jsfiddle.net/J6TN8/2/

提交回复
热议问题