Skip to content

Instantly share code, notes, and snippets.

@meaganewaller
Created January 7, 2015 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meaganewaller/7f8f62cce8631f03cf74 to your computer and use it in GitHub Desktop.
Save meaganewaller/7f8f62cce8631f03cf74 to your computer and use it in GitHub Desktop.
bootstrap modal not working :(
<div class="modal-header">
<!-- modal body & stuff goes here -->
</div>
def modal_action
respond_to do |format|
format.html
format.js
end
end
$("#modal-window").html("<%= j render("modal_action") %>");
$("#modal-window").modal('show');
@meaganewaller
Copy link
Author

  1. When I click the "My Modal" link the screen fades out to grey, nothing is clickable like it would when a modal opens, except no modal ever opens.
  2. When I put a console statement in modal_action.js.erb and click the "My Modal" link it gets printed to the console.
  3. When I put a puts statement in the _modal_action.html.erb partial it gets printed in the Rails console when I'm running the server so I know it's being rendered via the modal_action.js.erb it just doesn't show up.

Any ideas?

I used a few code examples to get going,

@mgedmin
Copy link

mgedmin commented Jan 7, 2015

I don't see a <div class="modal-dialog"> or a <div class="modal-content"> anywhere in your HTML. Could that be the problem?

Which bootstrap version do you use?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment