2

Will you please tell me what is wrong about this code !!!

<div>
    <ul class="nav navbar-nav">
        <li class="active"><a href="#">Home</a></li>
        <li><a href="#">About</a></li>
        <li><a href="#">Contact</a></li>
        <li><a href="#">Register</a></li>

        <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">My Profile <span class="caret"></span></a>

            <ul class="dropdown-menu">
                <li><a href="#">Messages</a></li>
                <li><a href="#">Friends</a></li>
                <li><a href="#">Profile</a></li>
                <li><a href="#">Settings</a></li>
                <li><a href="#">Login</a></li>
            </ul>
        </li>
    </ul>

    <ul class="nav navbar-nav navbar-right">
        <li><a href="#">Logout</a></li>
    </ul>
</div>

I am also including this within my html file :

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css">

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"</script>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

When i click the dropdown menu it is not functioning at all , please i need help.

2
  • 1
    Your "bootstrap.min.js" file is not correctly linked. You are missing the closing ">"
    – Marin N.
    Commented Jun 10, 2016 at 15:04
  • Correct , But it is correctly typed on my original code.
    – wfareed
    Commented Jun 10, 2016 at 15:12

1 Answer 1

3

The jquery call should come first.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

also, you forgot the close tag on the bootstrap call.

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"</script>

should be:

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
                                                                                 ˆ
4
  • Thanks , I changed the order of files and it is functioning pretty well now :)
    – wfareed
    Commented Jun 10, 2016 at 15:11
  • Good catch @EduRuiz Commented Jun 10, 2016 at 15:12
  • 1
    @wfareed you are welcome, please click in "accept answer". Is good for the community and for my reputation :D
    – Edu Ruiz
    Commented Jun 10, 2016 at 15:15
  • 1
    @HanletEscaño thanks! :) This is the kind of stuff that happens sometimes and we spend hours trying to solve to find that the problem is a typo.
    – Edu Ruiz
    Commented Jun 10, 2016 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.