Accordion without codecademy


#1


I'm trying to use the accordion on my own. It works in the exercise, but it just shows as regular html elements when I do it on my own. What's wrong?

<!DOCTYPE html>
<html>
<head>
  <title>FreshnHealthyEats-Recipes</title>
  <meta charset="utf-8"/>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

  <link href='https://fonts.googleapis.com/css?family=Roboto:300,400,700' rel='stylesheet' type='text/css'>

  <link rel="stylesheet" type="text/css" href="styles.css">

<script type='text/javascript' src='script.js'></script>

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>

        <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>

</head>
<body> 
<div id="menu">
        <h3>Breakfast</h3>
            <h3><a href="#">Heading for first sentence</a></h3>
        <div>
        <p>Appetizers>
        </div>          
        <h3><a href="#">Heading for second sentence</a></h3>            
        <div>
        <p>Entrees>
        </div>
        <h3><a href="#">Heading for third sentence</a></h3>
        <div>
        <p>Salads and Sides</p>
        </div>
        <div>
		<p> Desserts </p>
		</div>
		<div>
		<p> Diwali Snacks </p>
		</div>
		
                
            
        </div>
  
</html>

script.js:

$(document).ready(function(){
    $('#menu').accordion();
    
    
});


#2

I'd try putting my link to script.js after the jQuery files.

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>
<script src="script.js"></script>

Also make sure that the path to script.js is correct.
Last, you forgot the closing </body> before </html>

Let us know if that works?


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.