jQuery   发布时间:2022-03-30  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了jquery – 在表行中启用“禁用控件”大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我想在选相应的chkView时启用该行的编辑和删除复选框,如果未选中则禁用它们.首先,这段代码根本没有触发.我哪里错了.

http://jsfiddle.net/75rVH/1/

HTML

<table id="table_forms">
    <tr>
        <td><input type="checkBox" class="chkView"/>View</td>
        <td><input type="checkBox" class="chkEdit" disabled/>Edit</td>
        <td><input type="checkBox" class="chkdelete" disabled/>delete</td>
    </tr>
   <tr>
        <td><input type="checkBox" class="chkView"/>View</td>
        <td><input type="checkBox" class="chkEdit" disabled/>Edit</td>
        <td><input type="checkBox" class="chkdelete" disabled/>delete</td>
    </tr>
</table>

JS:

$(document).on('change','.chkView',function(){
var row = $(this).closest('tr');
    if($(this).prop("checked",truE))
    {
        $(row).find('.chkEdit').prop("disabled",falsE);
        $(row).find('.chkdelete').prop("disabled",falsE);
    }
    else
        {
        $(row).find('.chkEdit').prop("disabled",truE);
        $(row).find('.chkdelete').prop("disabled",truE);
    }

});

@L_616_9@

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

你错过了’.’在选择器类中.

演示:

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

大佬总结

以上是大佬教程为你收集整理的jquery – 在表行中启用“禁用控件”全部内容,希望文章能够帮你解决jquery – 在表行中启用“禁用控件”所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。