Here is my code
<div class="label-container">
<label><%= t('select_a_prerequisite') %><span class="necessary-field">*</span>:
<b class="sel-list">
<%= link_to_function t('all'), "$$('input.list-subject').each(function(checkbox) { checkbox.checked = true; });" %>,
<%= link_to_function t('none'), "$$('input.list-subject').each(function(checkbox) { checkbox.checked = false; });" %>
</b>
</label>
</div>
<div class="categories">
<% @aau_subjects.each do |c| %>
<div class="each_category">
<%= check_box_tag "prerequisite[]",c.id, :class => "list-subject" %> <label><%= "#{c.aau_subject_name} #{c.aau_subject_code} " %></label>
</div>
<% end %></div>
In this when i click on "all" , it should make true for all check box, but its not working and checkbox are displayed with default true. please suggest me where i am going wrong , or any other solution for on click true and false.
Aucun commentaire:
Enregistrer un commentaire