When you click on the checkbox, the change event should work. In which all other checkboxes should become unckecked. When you click nothing happens, put a breakpoint, does not even enter. What exactly is wrong? Thanks in advance for your reply.
I use to display checkboxes library https://github.com/fntneves/jquery-labelauty
projects.coffee
jQuery(document).on 'turbolinks:load', -> $('.control__check').labelauty checked_label: "Cancel", unchecked_label: "Select", force_random_id: true $('.control__check').change -> thisElement = $(this) if ($(this).prop("checked")) $('ul.content-list content-list__my-response content-list_responses'). find('.control__check labelauty').each (index, elem) -> if ($(elem).prop("checked") && !thisElement ) elem.prop('checked', false) _responses.html.erb
<ul class="content-list content-list__my-response content-list_responses"> <% @project.responses.each do |response| %> <% if response.persisted? %> ................................................................ <div class="controls"> <%= check_box_tag '', true, false, { class: "control__check" } %> </div> ................................................................. </li> <% end %> <% end %> </ul> UPDATED 06/14/16:
This is the HTML checkbox source code:
<div class="controls"> <input type="checkbox" name="dfvfvfdvf" id="labelauty-179303" value="true" class="control__check labelauty" style="display: none;"> <label for="labelauty-179303"><span class="labelauty-unchecked-image</span> <span class="labelauty-unchecked">Select</span> <span class="labelauty-checked-image"></span> <span class="labelauty-checked">Cancel</span></label> </div>