Reputation: 33
I search through the net and cannot find a way. So far, I have tried:
<%= check_box_tag "course[location_ids][]", location.id, class: 'checkbox-inline'%>
This will output:
input type: "checkbox" name="course[location_ids][] id="course_location_ids_" value="1" checked="checked"
For some reason, it makes a checked input.
<%= check_box_tag "course[location_ids][]", location.id, :class => 'checkbox-inline'%>
does the same as the first one
How do I add a class inside of a check_box_tag
Upvotes: 3
Views: 9055
Reputation: 23681
You are not using the proper format
check_box_tag(name, value = "1", checked = false, options = {})
Change the tag to the following:
<%= check_box_tag "course[location_ids][]", location.id, false, class: 'checkbox-inline'%>
Note: The 3rd option is checked value, you need to change it according to your need
Refer: check_box_tag
Upvotes: 12