javascript - Select/Deselect multiple check boxes using Jquery in loop(Rails) -


I am working on ROR, I have two edges inside which I am displaying the record with the check box.

  & lt;% = form_tag some_path,: method = & gt; 'Post' Do% & gt; For loop & lt;% = check_box_tag 'id []', value is% & gt; Name for loop & lt;% = check_box_tag 'ids_of_second_loop []', value% & gt; Name End End & lt;% = submit_tag "Next"%> & Lt;% end% & gt;  

Now I wanted to implement a jquery where I can select / unselect the checkboxes.

If I am not directly in the loop, then I can,

I refer to the link given below for the implementation,

Loop Output ...

Enter image details here

it How to get ...

I will do something like

  Lt;% = form_tag some_path ,: method = & gt; 'Post' Do% & gt; Loop & lt;% = check_box_tag 'Ids []', for the value, category: 'parent'% & gt; Name & lt; Div class = 'children' & gt; For the loop <% = check_box_tag 'ids_of_second_loop []', value% & gt; End of name & lt; / Div & gt; End & lt;% = submit_tag "Next"%> & Lt;% end% & gt;  

Note that after the checkbox, "div class = 'children'" and class "parent" on all parent checkboxes

then javascript

  $ ('input.parent'). ('Change', function () {$ (this) .next ('children'). ('Input [type = checkbox]'). 'Check', $ (this) .prop ('check'))} }  

After the clicked checkbox, the cell searches for the next div with 'children', then it searches for all the input inside the div with the input = input, and existing The "checked" prop is set to the value returned by the input


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Algorithm negotiation fail SSH in Jenkins -

java - Messages from .properties file do not display UTF-8 characters -