i'm working on project (using codeigniter framework) contains grid lot of checkboxes. on selecting checkbox, pop (twitter bootstrap - modal) appears contains statements , respective sub-statements. statements selected using radio buttons , sub-statements selected using checkboxes.
eg: if select 1st statement, i'm supposed select respective sub-statements , not of 2nd. in order avoid selecting other sub-statements, have disable them. how can that?
radio1: statement 1 (enable - selected) chckbox1: sub-stmt1 (selected) chckbox2: sub-stmt2 (may 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 loops, 1 generating radio buttons (statements) , checkboxes (sub-statements).
i solved in different way
//hide checkboxes of other radio buttons if not selected selected
$(function() {
$('#comment').on('change', '.toggle-family', function() { if ($(this).attr('checked')) { $("[name='cbox[]']").addclass('hide'); $('.pi_'+$(this).val()).removeclass('hide'); } }); });
thank guys.
Comments
Post a Comment