Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8975631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:55:45+00:00 2026-06-15T18:55:45+00:00

The Dropdown is closing when I click into one of the fields. I have

  • 0

The Dropdown is closing when I click into one of the fields. I have to reopen it and then I can type until clicking in the next field. The values are preserved even when the dropdown is closed. How can I make it stay open?

html.erb

<ul class="nav secondary-nav">      
  <li><%= link_to image_tag('icons/lock_icon.png') + " Log In" +('<span class="caret"></span>').html_safe , '#', { :class => 'dropdown-toggle', 'data-toggle' => 'dropdown' } %>

    <ul id="dropdown-login" class="dropdown-menu" style="padding: 10px 10px 0px 10px; width: 240px;">

      <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>

        <li> 
          <div>
            <%= f.label :email %><br />
            <%= f.email_field :email %>
           </div>
        </li> 

        <li>
          <div>
            <%= f.label :password %><br />
            <%= f.password_field :password %>
          </div>
        </li>

        <li> 
          <% if devise_mapping.rememberable? -%>

            <div>
              <%= f.check_box :remember_me %> <%= f.label :remember_me %>
            </div>
          <% end -%>
        </li> 

        <li>
          <div><%= f.submit "Sign in" %></div>
        </li>

      <% end %>
    </ul>
  </li>
</ul>

i use javascripts but not worked, such as
1.

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

2.

 <script type="text/javascript">
    $('.dropdown-menu').find('form').click(function (e) {
        e.stopPropagation();
    });
 </script>

3.

<script type="text/javascript">
  $('body')
    .off('click.dropdown touchstart.dropdown.data-api', '.dropdown')
    .on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() });
</script>

and in application.js

//= require jquery
//= require jquery_ujs
//= require dataTables/jquery.dataTables
//= require dataTables/jquery.dataTables.bootstrap
//= require redactor-rails
//= require_tree .
//= require bootstrap-alert
//= require bootstrap-dropdown

Can anyone help me with my problem?

UPDATE – SOLVED

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:55:46+00:00Added an answer on June 15, 2026 at 6:55 pm

    add class=”dropdown” into first li, such as

    <li class="dropdown"><%= link_to image_tag('icons/lock_icon.png') + " Log In" +('<span class="caret"></span>').html_safe , '#', { :class => 'dropdown-toggle', 'data-toggle' => 'dropdown' } %>
    

    and add javascript..

     <script type="text/javascript">
        $('.dropdown-menu input, .dropdown-menu label').click(function(e) {
            e.stopPropagation();
        });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Short story: stopPropagation() prevents a dropdown menu from closing - which is good. But
I am creating a dropdown contact form and you can view the code below:
I have a dropdown selector, with values from 1-4. Depending on the selection, subsequent
Hi I have two dropdown menus: priceMaximum and mortgageMaximum I want it so if
I have a few dropdown list to style the font of a div. However
I have a dropdown list and some textboxes (5). I would like to pass
I have a Dropdown in my TopBar, built with the Twitter Bootstrap CSS framework.
I have a php file which has one form and 2 submit buttons, onclick
Dropdown menu (the right one, with city names like gudauri) here dev.holiday.ge/xhtml/main.html must look
My dropdown menu in Bootstrap doesnt appear to be working - can anyone alert

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.