Rails Bootstrap close modal
I am using a Bootstrap mod in a Rails app. I would like to close the modal view.
For example the Bootstrap documentation has:
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
I've tried this:
<%= submit_tag 'Cancel', :type => :reset, :class => "btn btn-danger", :input_html => {data-dismiss="modal" aria-hidden="true"} %>
But I am getting syntax error.
I want to use the same method to close the submit button.
I could close it in jquery, but I would really like to close it in the form.
Thank!
+3
source to share
1 answer
:input_html => {data-dismiss="modal" aria-hidden="true"}
Your hash is incorrect. Try the following:
:input_html => {"data-dismiss" => "modal", "aria-hidden" => "true"}
I believe you don't even need :input_html
it and it can use the internal hash values ββright away, like:
<%= submit_tag 'Cancel', :type => :reset, :class => "btn btn-danger", "data-dismiss" => "modal", "aria-hidden" => "true" %>
+8
source to share