dongtui9168 2013-05-06 06:56
浏览 27

多个单选按钮及其相关的复选框

I'm working on a project (using the CodeIgniter framework) which contains a grid with a lot of checkboxes. On selecting a checkbox, a pop up (twitter bootstrap - modal) appears which contains statements and its respective sub-statements. Statements are to be selected using radio buttons and sub-statements are to be selected using checkboxes.

Eg: If I select the 1st statement, then I'm supposed to select its respective sub-statements and not that of the 2nd. In order to avoid selecting the other sub-statements, I have to disable them. How can I do that?

radio1: statement 1 (enable - selected) chckbox1: sub-stmt1 (selected) chckbox2: sub-stmt2 (may be selected or may not be)

radio2: statement 2 (enable - not selected) chckbox1: sub-stmt1 (disable) chckbox2: sub-stmt2 (disable) chckbox3: sub-stmt3 (disable)

radio3: statement 3 (enable - not selected) chckbox1: sub-stmt1 (disable)

I'm using nested for loops, one for generating radio buttons (statements) and another for checkboxes (sub-statements).

  • 写回答

1条回答 默认 最新

  • duansanzi5265 2013-05-07 05:27
    关注

    I solved it in a different way

    //hide checkboxes of other radio buttons if they are not selected selected

    $(function() {

       $('#comment').on('change', '.toggle-family', function() { 
    
           if ($(this).attr('checked')) { 
    
                $("[name='cbox[]']").addClass('hide'); 
                $('.pi_'+$(this).val()).removeClass('hide'); 
           } 
       }); 
    

    });

    Thank you guys.

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题