2

I am new to bootstrap and doing small examples by seeing the example.I have downloaded the bootstrap css files from bootstrap and I am using bootstrap 3.I am just creating a nav bar and following is my code

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Employee Directory</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="jquery/jquery-1.9.1.min.js"></script>
    <!--<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">-->
    <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css">


    <script src="bootstrap/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="icomoon/style.css">


</head>
<body>
<div class="navbar navbar-default navbar-fixed-top">
    <div class="navbar-header"><a class="navbar-brand" href="#">Brand</a></div>
    <ul class="nav navbar-nav">
       <li><a href="#">Link</a></li>
       <li><a href="#">More</a></li>
       <li><a href="#">Options</a></li>
    </ul>
    <ul class="nav navbar-nav pull-right">
       <li class="active"><a href="#">Home</a></li>
    </ul>
</div>
</body>
</html>

my app name is gift

If I am accessing the file from tomcat server like http://localhost:8080/gift/index.html then I am getting error.Please see the screenshot

enter image description here

But if right click on the index.html and open it google chrome then I am not getting any error. (the below image) Please tell me why is it so?

enter image description here

6
  • well from your code, there isn't any mistakes, just try restructuring with standard structure where you put the jquery before </body>. And try to check each of the error by clicking on them in the browser. It may help Commented Feb 10, 2014 at 5:49
  • @rockStar so where do I need to keep the jquery? Commented Feb 10, 2014 at 5:54
  • just a wild guess,remove http: from the src inclusion and then add the bootstrap file => href="//netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" Commented Feb 10, 2014 at 6:12
  • @NoobEditor Thanks for trying to help.I did your way(removed http:) like this <link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" media="screen"> still the same.I have also downloaded the bootstrap.min.css and kept that in the css folder and tried this way <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen"> still the same Commented Feb 10, 2014 at 6:24
  • no, i didnt say remove the http, you actually need it. and put the jquery code before the </body> tag Commented Feb 10, 2014 at 6:39

1 Answer 1

1

call jquery https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js in header before calling bootstrap

Sign up to request clarification or add additional context in comments.

21 Comments

Thanks for the answer but I am doing this. see <script src="jquery/jquery-1.9.1.min.js"></script> placed before bootstrap
try to use 1.6.1 it is working for me as some feature is depriciated in jquery1.9.1
I can not use older version because bootstrap does not support
i m using this <script type="text/javascript" src="ajax.googleapis.com/ajax/libs/jquery/1.6.1/…> <script src="../js/bootstrap/bootstrap.min.js"></script> <link href="../css/bootstrap/bootstrap.min.css" rel="stylesheet" /> <link href="../css/bootstrap/bootstrap-theme.min.css" rel="stylesheet" />
Are you using bootstrap 3?
|

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.