Rails Bootstrap Modal not appearing

cleve yeo

I have included Bootstrap modal inside my page. But my page just gets grey out when i press on the button and no pop dialog appears. However, when i press the ESC button, the dialog flashes once before exiting. Another instance i tried was, i included //= bootstrap/modal inside my application.js file. Inside this file i also had the line //= bootstrap. When i have both of this line included, the modal only stays for less than 1 second when i press the button.

Below is the code of my view page,

<% provide(:title, "Log in") %>
<div class="center jumbotron">
<h1> Kaching </h1>
<div class = "row" >
  <div class="col-md-6 col-md-offset-3">
    <%= form_for(:session, url: login_path) do |f| %>

    <%= f.label :logID, "Log ID" %>
    <%= f.text_field :logID %>

    <%= f.label :password %>
    <%= f.password_field :password, class: 'form-control' %>

    <%= f.submit "Log In", class:"btn btn-primary" %>
    <% end %>
  </div>
</div>
</div>
<div class="container">
  <h2>Small Modal</h2>
  <!-- Trigger the modal with a button -->
  <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Small Modal</button>

  <!-- Modal -->
  <div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog modal-sm">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">Modal Header</h4>
        </div>
        <div class="modal-body">
          <p>This is a small modal.</p>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div>
      </div>
    </div>
  </div>
</div>

Thanks

Anoob K Bava

There seems to be no issue regarding your code. For the sake of clarity, i will be explaining all the step regarding modal implementation.

steps 1. include bootstrap.js in your JavaScript, and kindly check there is only bootstrap.js or bootstrap.min; both of them should not present.

2.Modal calling step should be

<button type="button" class="btn btn-primary success" data-toggle="modal" data-target="#myModal">Login
 </button>

3.On calling the modal, the codes are

    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
        <h4 class="modal-title" id="myModalLabel">Please Login</h4>
      </div>
      <div class="modal-body">
        <div class="col-xs-8">
          <input type="text" class="form-control" placeholder="user name">
          <input type="password" class="form-control" placeholder="password">
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default"data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary info">Login</button>
      </div>
    </div>
  </div>
</div>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Rails Bootstrap Modal not appearing

From Dev

Twitter Bootstrap Modal - not appearing

From Dev

Bootstrap 3 modal form not appearing

From Java

Bootstrap modal appearing under background

From Dev

Bootstrap 3 modal form not appearing

From Dev

Bootstrap Datepicker appearing at incorrect location in a modal

From Dev

jQuery datapicker appearing behind twitter bootstrap modal

From Dev

Bootstrap datetime picker in Modal mode not appearing

From Dev

Bootstrap modal with opacity appearing behind the background

From Dev

Ruby on Rails bootstrap modal

From Dev

Render a Rails view in a Bootstrap modal

From Dev

Twitter Bootstrap Modal not working in Rails

From Dev

bootstrap modal with Simple Form Rails

From Dev

How to use bootstrap modal with rails?

From Dev

Issue with Bootstrap Modal with Rails App

From Dev

bootstrap modal dissappearing in rails 4

From Dev

Twitter bootstrap modal appearing in wrong location, not centered and the buttons are not clickable

From Dev

Rails Devise Bootstrap Sign Up modal

From Dev

Devise Forgot password in bootstrap modal in a Rails Application

From Dev

rails 4 bootstrap 3 ajax modal

From Dev

Bootstrap 3 modal error with Rails 4

From Dev

Rails 5 Bootstrap 3 Modal / Ajax not working

From Dev

Ruby on Rails Dynamic Bootstrap Modal Table

From Dev

Rails - Editing item from list by bootstrap modal

From Dev

Rails Bootstrap modal trying to update wrong model

From Dev

Rails Devise Bootstrap Sign Up modal

From Dev

Devise Rails Bootstrap - sign up modal

From Dev

Rails form above Twitter Bootstrap modal

From Dev

Rails: How to add an object through a bootstrap modal?

Related Related

HotTag

Archive