Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use bootstrap Modal with link_to in rails?

I had asked this earlier but unfortunately I am still stuck. I have a link_to like this

<%= link_to "Click Here", page_path,, :id => 'login', "data-toggle" => "modal" %>

in page.html.erb (the page which I want to load in modal when the link gets clicked),I have

<div class="modal" id="loginModal">
    Test Content
</div>

in assets/page.js.coffee

$('#loginModal').modal(options)

but still, the link is not opening in a modal Any help ?

like image 966
iCyborg Avatar asked Mar 03 '13 18:03

iCyborg


1 Answers

Add data-target

<%= link_to "Click Here", page_path, :id => 'login', "data-toggle" => "modal", 'data-target' => '#loginModal' %>
like image 91
Intrepidd Avatar answered Sep 21 '22 18:09

Intrepidd