前提・実現したいこと
railsとBootstrapを使っています
モーダルを使ってCRUD操作(主にユーザーの作成)をしようと考えているのですが、
モーダルを紐づけたボタンを押しても、モーダルを表示してくれません
おそらく初歩的なミスだと思うのですが、教えていただけるとありがたいです。
Bootstrap規格のコンポーネントやJQueryのほかのアイテムは問題なく稼働している
Bootstrap自体の導入は問題なさそうです
なお、記事はこちらを参考にしています
https://logist3.com/rails5-bootstrap-modalwindow/
/app/view/static_pages/about #これがモーダルと紐づいているボタンです <%= link_to 'New User', new_user_path, remote: true, class: "btn btn-lg, btn-primary" %> ``` ``` app/views/users/new.js.erb $("#user-modal").html("<%= escape_javascript(render 'form') %>") $("#user-modal").modal("show") ``` ``` /app/view/share/_form <div class="modal-dialog" role="document"> <div class="modal-content"> <%= form_with(model: user, remote: true) do |form| %> <% if user.errors.any? %> <div id="error_explanation"> <h2><%= pluralize(user.errors.count, "error") %> prohibited this user from being saved:</h2> <ul> <% user.errors.full_messages.each do |message| %> <li><%= message %></li> <% end %> </ul> </div> <% end %> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">New message</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <div class="form-group field"> <%= form.label :name , class: "form-control-label" %> <%= form.text_field :name, id: :user_name, class: "form-control" %> </div> </div> <div class="modal-footer actions"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <%= form.submit class: "btn btn-primary"%> </div> <% end %> </div> </div> ``` ### 補足情報(FW/ツールのバージョンなど) cloud9使用
あなたの回答
tips
プレビュー