【发布时间】:2014-04-17 09:27:41
【问题描述】:
我想在我的应用程序中通过 jquery 检查所有复选框。我有以下布局:
.row
.col-md-12
= field_set_tag t('car.places')
%input{type: "checkbox", id: "selectAll"}/
= t('car.select_all_locations')
%table.table.table-striped.table-bordered.centered#car_locations
%thead
%tr
%th{width: "200"}= t('cars.select')
%th{width: "300"}= t('cars.your_locations')
%th{width: "200"}= t('cars.location_type')
%th{width: "400"}= t('cars.after_hours_availability')
%tbody
- Location.all.each do |location|
%tr
%td= check_box_tag "car[location_ids][]", location.id, @car.location_ids.include?(location.id), id: "test"
%td= location.name
%td= location_type(location)
%td= after_hours_availability(location)
这件事最好的方法是什么?
【问题讨论】:
标签: javascript jquery ruby-on-rails ruby-on-rails-4