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

  • Home
  • SEARCH
  • 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 7591789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:44:19+00:00 2026-05-30T20:44:19+00:00

In app/assets/javascripts , I have saved bootstrap.js (from twitter github). I have the BootStrap

  • 0

In app/assets/javascripts, I have saved bootstrap.js (from twitter github). I have the BootStrap CSS that pertains to popover and tooltip loaded — in app/assets/stylesheets

From my show.html.erb in app/views/questions:

    <button class="btn" id="button1"><%= @question.option_1 %></button>
    <script type="text/javascript">
    $(function() {
      $(".btn").click(function() {
      var idname = this.id;
        $("#"+idname).addClass("clicked");
        $("#"+idname).siblings().removeClass("clicked");
    });

    });

    $(function () {
      $(".btn").popover( offset: 5,
                         placement: 'left');
    });
    </script>

My application.js file in app/assets/javascripts has these as the last 3 lines:

    //= require jquery
    //= require jquery_ujs
    //= require_tree .

It looks like they are just comments, but I looked up the syntax and it seems to be correct.

Things I have tried:
1.) Loaded all of the CSS (not just those pertaining to popover).
2.) All of the other relevant stackoverflow posts

  • 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-05-30T20:44:20+00:00Added an answer on May 30, 2026 at 8:44 pm

    I think that you have everything that you need included in your project, but I see a couple of things missing from the HTML/Javascript for your button.

    First, the popover requires content that will be shown when you hover over the button. This is done by specifying information in a “data-content” attribute of the element. So your button will look like this:

    <button class="btn" id="button1" data-content="Popover Content">
        <%= @question.option_1 %>
    </button>
    

    Then, in the javascript to load the popover on rollover, you’re specifying a couple of options. These will need to be wrapped in curly braces:

    <script type="text/javascript">
        $(function () {
             $(".btn").popover(
                {
                    offset: 5,
                    placement: 'left'
                }
            );
        });
    </script>
    

    With those two changes, you should be up and running with a popover that appears on hover of your button that contains the text “Popover Content”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a rails app that is combining javascript assets using Jammit , and
In my Javascript heavy Web app, I have some scripts that are loaded in
I have a Rails app that uses Cloudfront as its CDN and sprockets to
Some of the users of our Ruby on Rails app have complained that page
I have a rails app that has picked up a bit of traction, but
ActionView::Template::Error (HandleScope::HandleScope: Entering the V8 API without proper locking in place (in /app/app/assets/javascripts/application.js)): 3:
Currently to require a javascript template file, I put the file in app/assets/javascripts/templates ,
I have recently upgraded an app from Rails 3.0 to 3.1. I have followed
I currently have a Rails 3.1 app that hosts multiple sites for several different
I have a Cappuccino app that I am integrating with a Rails backend. A

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.