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 7691717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:41:20+00:00 2026-05-31T20:41:20+00:00

Hey so I am using Rails PJAX for my web application with twitter bootstrap

  • 0

Hey so I am using Rails PJAX for my web application with twitter bootstrap Jquery Plugins. I can’t seem to get both of them working together. So for an example, I have pagination and have some hover effects on some elements.

When I initially reload the page and hover over everything it works. When I click on the next on the pagination, the page up dates and then when I hover, it does not work. Logically I would think because the DOM was already loaded once. What can I do?

Also note that using Rails Pjax on a Rails 3.2 Application, I haven’t had to write any Jquery in the application for Pjax.

https://github.com/nz/pjax-rails
http://twitter.github.com/bootstrap/javascript.html#popovers

Solved:

I actually solved the issue by

$(document).on('ready ajaxComplete', function() { 
   $('a').popover() 
});
  • 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-31T20:41:21+00:00Added an answer on May 31, 2026 at 8:41 pm

    Short version: use the pjax:end event to apply bootstrap behavior to new elements.

    When pjax loads the new content, the bootstrap handlers haven’t been bound to all of the elements. With typical jQuery elements, you can use ‘live’ to have jQuery detect new content and apply the correct handlers. Sorry if this first part is stuff you already know.

    For example if this is in your jQuery ready function:

    $('a').click(function() { alert('here') }
    

    If you dynamically load content containing another anchor element, the click handler won’t be bound to it.

    But if you do this:

    $('a').live('click', function() { alert('here') }
    

    when the new content is loaded, jQuery will add the click handler because it’s bound using live.

    Back to bootstrap. For something like a popover, there is no equivalent ‘live’ method as far as I can tell. You can’t change this:

    $('a').popover()
    

    to this:

    $('a').live('popover')  # WON'T WORK
    

    So if the anchor is loaded via pjax (or ajax or anything dynamic), any new anchors aren’t bound as popovers.

    The way around that is it to bind a pjax:end event so you can do stuff after the pjax content is inserted. In the popover example:

    $(document)
      .on('pjax:end', function() { $('a').popover() })
    

    Whenever pjax content is loaded it will run that function and apply the popover functionality to any anchor elements, including newly inserted ones. You could further isolate it via a selector to just the container with the new content so you don’t reapply functionality to things that haven’t changed.

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

Sidebar

Related Questions

Hey I hope you can help me. I am using rails 3 with the
Hey all, I'm running into an error using form_tag in Rails 2.3 and can't
Hey all i've been using some filters. Not all of them seem to work
Hey, I'm using Rails 2.3.5 and using rufus scheduler to send periodic emails. This
Hey, i have some experience with MVC. but I'm new to rails. I'm using
Hey right now I'm using jQuery and I have some global variables to hold
Hey I am developing an desktop application using Spring and Hibernate, and I have
Hey, I'm using Levenshteins algorithm to get distance between source and target string. also
Hey guys, I'm using Twitter's PHP API, called twitterlibphp , and it works well,
Hey guys I am making a terminal application using Swing and Apache Commons. I

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.