Lino
Lino

Reputation: 314

Bootstrap 4: Dropdown in <td> not showing

I'm trying to create a dropdown in a table-element using Bootstrap 4 Framework. The inspector shows that the content from the WP-Database is loaded correctly, but they remain greyed out. Even if I click the button, that does not change. enter image description here

So basically, the dropdown options don't get displayed / aren't triggered. Where am I going wrong?

Actual code:

<td>
    <div class="dropdown">
        <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Auswählen
        </button>
        <ul class="dropdown-menu" aria-labelledby="dropdownMenuButton">
        <?php
            foreach($players as $player):
                echo "<li class='dropdown-item'><a href='#'>$player->post_title</a></li>";
                endforeach;
        ?>
        </ul>
    </div>
</td>

Upvotes: 0

Views: 472

Answers (1)

Niko Modric
Niko Modric

Reputation: 665

This is what W3 school says. "Add the .dropdown-menu class to a "div" element to actually build the dropdown menu." I think you need to change "ul" into "div".

Upvotes: 2

Related Questions