【发布时间】:2018-05-14 07:33:32
【问题描述】:
我在table 的表单内有以下button_tag:
<div class="table-responsive tableBG">
** If I move the button here, it works perfectly **
<table class="table table-striped table-sm table-mini">
<thead class="thead">
<tr>
<th>...</th>
</tr>
</thead>
<tbody>
<tr>...</tr>
...
<%= form_for article, :html => {:class => 'toggle'} do |f| %>
<%= f.hidden_field :disable, value: true %>
<%= button_tag type: 'submit', class: "btn-mini" do %>
<i class="fa fa-eye-slash" aria-hidden="true"></i>
<% end %>
<% end %>
...
</tbody>
</table>
</div>
我的 index.js.erb(每 10 秒调用一次,呈现上表):
$("#todaysarticles").html("<%= escape_javascript(render(:partial => 'todaysarticles')) %>")
此按钮在表格外完美工作(在代码中注释的第一个 div 中),但在 ajax 调用(部分重新加载)后,它在表格内根本不起作用。
即使在 ajax 调用之后,我也有几个可以在表格内使用的 link_to,但是表单的 button_tags 根本不起作用。
【问题讨论】:
标签: html bootstrap-4 ruby-on-rails-5 twitter-bootstrap-rails