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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:27:22+00:00 2026-06-09T15:27:22+00:00

New to posting on stackoverflow here, so my apologies in advance if I messed

  • 0

New to posting on stackoverflow here, so my apologies in advance if I messed anything up here.

I’m using Twitter Bootstrap’s popovers. My popovers seem to be working for elements that I manually type into my HTML document – but NOT the elements that I dynamically generate via Javascript / Ajax.

For example, the popover seems to work if I manually add this directly to my HTML document:

<p rel=popover data-content='It is so simple to create a tooltop for my website!' data-original-title='Twitter Bootstrap Popover'>hover for popover</p>

But what I really need is for my dynamically generated elements to have popovers. I use an XMLHttpRequest to send a request to a PHP file, and then grab the responseText and display it. When I add this line of code to my aforementioned PHP file:

 echo "<p rel=popover data-content='It is so simple to create a tooltop for my website!' data-original-title='Twitter Bootstrap Popover'>hover for popover</p>";

… surely enough, the words “hover for popover” appear – but the popover itself doesn’t work!

This has been driving me nuts for some time and it would be incredible if someone could lend me a helping hand! I’ve also added the JQuery function I’m using to enable Bootstrap’s popovers below, for what that’s worth.

$(function (){
$("[rel=popover]").popover({placement:'left'});
}); 

I’ve done a thorough search of similar problems and the best I could find was this link. But that link doesn’t seem to have any solutions either. Thanks in advance again!

UPDATE:

Fixed! Many thanks to everyone who helped out. My problem was that the function was being called BEFORE the elements were added into the Document Object Model. There are multiple possible fixes – I simply tested out the solution by shifting the popover function to the END of the Ajax function and it worked!

  • 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-09T15:27:23+00:00Added an answer on June 9, 2026 at 3:27 pm

    You need to call $("[rel=popover]").popover({placement:'left'}); AFTER the elements are in the DOM.

    UPDATE

    If you are using jQuery

    $(element_selector)
      // load results into HTML of element_selector
      .load('your/php/file')
      // when done, initialize popovers
      .done(function(){
        $("[rel=popover]").popover({placement:'left'});
      });
    

    OR a catch all for jQuery ajax requests

    $.ajaxComplete(function(){
        $("[rel=popover]").popover({placement:'left'});
      });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm posting a file in Javascript using the new FormData interface. When I send
Kinda new posting up questions here so bear with me. I had to install
New to posting here but got many really useful bits of help already. I
new on ruby and using windows xp and rails 3, i want to send
new here and new to jQuery. I've searched for an answer to my question/
I'm really new to PHP and JavaScript and I made a PHP posting script
I'm glad stackoverflow exists at least there is traffic. Sorry for asking these here
I was asked to post this as a question on StackOverflow by http://twitter.com/jonathanjulian which
I'm new to posting on this forum but can't tell you how many times
Here i make 5 Tab buttons that are working proper but now i want

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.