Open工作正常,但没有关闭模式。这是我的档案:
在client.haml (客户端布局)中
= link_to t('.mail to admin'), blame_path(@admin), remote: true routes.rb
get "blame/:admin", to: 'pages#blame', as: 'blame'blame.js.erb
$('#blamepoint').html("<%= j(render 'blame') %>");
$('#blame').modal('toggle');_blame.haml
.modal#blame.fade.hide{tabindex: "-1"}
= form_with(url: admin_notify_path(@admin), method: "get", id: 'blameform') do
.modal-dialog
.modal-content
.modal-header
%h5.modal-title Send a message to vote admin
%button.close{"aria-label" => "Close", "data-dismiss" => "modal", type: "button"}
%span{"aria-hidden" => "true"} ×
.modal-body
.form-group
= label_tag :message
= text_field_tag :message, '', class: 'form-control'
%small.form-text.text-muted This text will not be published.
.modal-footer
%button.btn.btn-secondary{"data-dismiss" => "modal", type: "button"} Close
= submit_tag 'Send to admin', id: 'foo', class: 'btn btn-primary', 'data-toggle' => 'modal'Javascript
$(document).on("click", '#foo', function(event) {
console.log("link clicked");
$('#blame').modal('toggle');
});console.log("link clicked");正在工作,文本出现在控制台中。
我已经考虑过的一些资源包括: https://stackoverflow.com/questions/16598213/how-to-bind-events-on-ajax-loaded-content https://stackoverflow.com/questions/52797328/rails-bootstrap-modal-not-closing bootstrap modal popup not closing
发布于 2021-03-08 21:12:25
经过漫长的搜索过程,尝试了n个错误,我发现application.js中的以下application.js插件导致引导模式不能正常工作:
import "tablednd/js/jquery.tablednd"一旦被排除在外,这种模式就能按需要工作。现在将寻找另一种解决方案。希望这能防止别人浪费宝贵的时间(数周)来解决这样一个“愚蠢”的错误。
一个问题:你必须小心使用吗?
https://stackoverflow.com/questions/66426374
复制相似问题