复选框状态更改时刷新div

时间:2015-02-27 22:48:56

标签: javascript jquery ruby-on-rails

当我选中或取消选中复选框时,我正在尝试使用ID“ship-info-update”来获取我的div。我搜索了很多,但我似乎无法正常工作。

以下是我的_form.html.erb

的一部分
  <%= field_set_tag "Shipping Info" do %>
    <%= f.input :noship, :as => :boolean, label: 'No physical goods will be shipped', :id => "noship-checkbox" %>

    <div id="ship-info-update">

      <%= f.simple_fields_for :package do |p| %>

        <% if @campaign.noship == true %>
          <%= @campaign.weight = 0 %>
        <% else %>
          <%= p.input :weight, hint: 'Package weight of one unit in pounds (lbs)' %>
        <% end %>

      <% end %>
    </div>

  <% end %>

0 个答案:

没有答案
相关问题