Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap popovers not working in table

I've included the following in my html file:

<h:outputStylesheet name="css/bootstrap.css" />
<h:outputScript name="js/jquery-2.0.2.min.js" />
<h:outputScript name="js/bootstrap-tooltip.js" />
<h:outputScript name="js/bootstrap-popover.js" />

The part that is supposed to make the popover:

<ui:repeat var="lowFareCalenderSearchItem" value="#{lowFareCalenderSearchItems}">
    <td>
        <a href="#" id="searchItem" class="btn" rel="popover">#searchResult.getTotal()}</a>
        <script>
        $("#searchItem").popover({
            title: "title",
        content: "content"
        });
        </script>                               
    </td>
</ui:repeat>

The popovers I'm trying to get to display don't turn up when I hover over or click the button.

I have looked at other similar questions, and nothing I've found there has worked for me.

Does anyone know why this could be happening?

like image 432
Skytiger Avatar asked Jul 25 '13 12:07

Skytiger


People also ask

How do I use bootstrap 5 popovers?

Popovers can be triggered via JavaScript — just call the popover() Bootstrap method with the id , class or any CSS selector of the required element in your JavaScript code. You can either initialize popovers individually or all in one go.

How does Bootstrap Popover work?

The Popover plugin is similar to tooltips; it is a pop-up box that appears when the user clicks on an element. The difference is that the popover can contain much more content. Tip: Plugins can be included individually (using Bootstrap's individual "popover. js" file), or all at once (using "bootstrap.

Does bootstrap 5 require Popper?

Many of our components require the use of JavaScript to function. Specifically, they require our own JavaScript plugins and Popper.

What is bootstrap table?

An extended table to the integration with some of the most widely used CSS frameworks. ( Supports Bootstrap, Semantic UI, Bulma, Material Design, Foundation)


1 Answers

It turns out that the popover can't just be put into the table cell.

I solved it by using a div and span inside the cell:

<td>
    <div>
        <span id="searchItem" rel="popover">
            Click to pop
        </span>

        <script>
            $(document).ready(function() {
                $("#searchItem").popover({
                    html: true,
                    animation: false,
                    content: "TO BE ANNOUNCED",
                    placement: "bottom"
                });
            });
        </script>
    </div>
</td>
like image 151
Skytiger Avatar answered Oct 11 '22 11:10

Skytiger