Problems implementing the jQueryUI Accordion feature

0

And I did a quick search on this resource and found this page;

link

Then I created a folder with the name of GUJ and within this folder I put three files;

One of JavaScript with the name of jquery-2.2.2.min.js and the other one with the name of jquery-ui.js

And I also put the index.html file

with these settings;

<!DOCTYPE html>
<html>

 <script type="text/javascript" src="jquery-2.2.2.min.js"></script>
  <script type="text/javascript" src="jquery-ui.js"></script>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">

$("#accordion").accordion({
      collapsible: true
    });

</script>


</head>
<body>
<div id="accordion">
  <h3>First header</h3>
  <div>First content panel</div>
  <h3>Second header</h3>
  <div>Second content panel</div>
</div>


</body>
</html>

It was to have this result;

link

But nothing happened.

I accept suggestions.

    
asked by anonymous 06.04.2016 / 19:27

1 answer

2

Remember that in jQuery the script should be used within the function of ready

Do as below and everything will go well:

          $(document).ready(function(e){ // essa é a parte que você esqueceu
            $("#accordion").accordion({
              collapsible: true
            });        
          });

If the answer works, give a UP.

    
06.04.2016 / 22:57