Note that there are some explanatory texts on larger screens.

plurals
  1. POrestricting user to check checkboxes based on my requirement
    primarykey
    data
    text
    <p>This is in addition to previous <a href="https://stackoverflow.com/questions/20422899/how-to-make-a-checkboxes3-checked-at-one-click-using-jquery">question</a></p> <p>I've got a bunch of checkboxes in a table, I would like to restrict the user to check the checkboxes based on following rules.</p> <ol> <li>If user is clicking any one of the checkbox in a particular row, the we have to make next two checkboxes checked programatically (jquery) and as well as uncheck (toggle).</li> <li>There will be Block button/checkbox, if user is clicking block button then we have to disable all checkboxes in that row, except already checked.</li> <li>We have restrict user to check checkbox, if there is no next two checkboxes available(i.e, unchecked). This is rule exception for last checkbox in a row (User can able to check last checkbox in a row).</li> </ol> <p>Here i have managed with 1 and 2 rules, but for third rule i'm not getting any idea.</p> <p><strong>Jquery</strong></p> <pre><code>$('.grp:checkbox').change(function () { var obj = $(this).parent().nextAll("td").slice(0, 2); if ($(this).is(":checked")) { //$(this).removeClass('grp'); obj.find(":checkbox").prop('checked', true); obj.find(":checkbox").prop('disabled', true); } else { obj.find(":checkbox").prop('checked', false); obj.find(":checkbox").prop('disabled', false); } }); $('.block').change(function (e) { var obj = $(this).parent().nextAll("td"); if ($(this).is(":checked")) { obj.find(":checkbox").prop('checked', true).prop('disabled', true); } else { obj.find(":checkbox").prop('checked', false).prop('disabled', false); } }); </code></pre> <p><a href="http://jsfiddle.net/naresh_k28/2JMgZ/" rel="nofollow noreferrer">Demo Fiddle</a></p> <p>if anyone giving me any suggestions, it may help full for me.</p> <p>Thanks in advance. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload