javascript - Dropdown Closes On Click in Rails App -


when click field in dropdown menu, menu closes. i've seen few questions relating (here , here) stop propagation wasn't working me.

this html dropdown.

<div id="shifted_navbar_left">       <a href="#" class="dropdown-toggle" data-toggle="dropdown">log-in <b class="caret"></b></a>       <ul class="dropdown-menu">         <div id="dropdown_log_in">           <h3> engineer sign-in</h3>           <%= form_for(:engineer, :url => new_session_path(:engineer)) |f| %>             <%= f.label :email %> <br>             <%= f.text_field :email %> <br />             <%= f.label :password %> <br>             <%= f.password_field :password%> <br />             <%= f.check_box :remember_me %>              <%= f.label :remember_me %> <br />             <%= f.submit 'sign in', class: "btn btn-primary"%> <br />             <%= link_to "forgot password?", new_password_path(:engineer) %>           <% end %>         </div>       </ul>   </div> 

i calling

<script type="text/javascript"> $('.dropdown-menu input, .dropdown-menu label').click(function(e) {     e.stoppropagation(); }); </script> 

from application.html.erb header file section. dropdown still disappears on click! need pick javascript game, feel should working.. there in rails blocking javascript running?

gemfile

#use jquery javascript library  gem 'jquery-rails'  gem 'turbolinks'  gem 'jquery-turbolinks' 

my application.html.erb tags

<%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %> <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> <%= csrf_meta_tags %> 


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -