Problems with dropdown menu with bootstrap

Asked

Viewed 1,210 times

1

I have a dropdown menu on my page. When I select the menu the following problems occur: 1) Nothing is selected, that is, I choose the option, but do not select anything. 2) Even if nothing is selected, the menu is open, closing when I select and even if I click somewhere on the page, no longer returns to normal.

This code I picked up on the net to change it to my use.

My cshtml(view):

<!DOCTYPE html>

<html>
<head>
    <title></title>
    <script src="~/Scripts/jquery-1.10.2.min.js"></script>
    <link href="~/Content/bootstrap.css" rel="stylesheet" />
    <script src="~/Scripts/bootstrap.min.js" type="text/javascript"></script>
    <script src="~/Scripts/bootstrap.js" type="text/javascript"></script>
</head>
<body>
    <div class="navbar navbar-inverse">
        <div class="Container">
            <ul class="nav navbar-nav">
                <li><a href="#">Home</a></li>
                <li><a href="#about">Technologies</a></li>
                <li><a href="#contact">Article</a></li>
                <li><a href="#contact">blog</a></li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle">News <b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <li><a href="#">Home</a></li>
                        <li><a href="#">Technologies</a></li>
                        <li><a href="#">Article</a></li>
                        <li><a href="#">blog</a></li>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {
            $('.dropdown-toggle').dropdown();
        });
    </script>

</body>

</html>

1 answer

3


It is sufficient to make the following amendment:

<a href="#" class="dropdown-toggle" data-toggle="dropdown">

Adding the attribute data-toggle="dropdown"

Browser other questions tagged

You are not signed in. Login or sign up in order to post.