JQuery Accordion doesn't work in Dreamweaver

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>

Hello! I’m trying to figure out why my “default” accordion doesn’t work. Is that a DW problem? Could be any conflict between Bootstrap and jQuery in that case? The same accordion in codecademy runs well.
https://www.codecademy.com/en/courses/web-beginner-en-jtFIC/2/3
Thank you a lot.
<In what way does your code behave incorrectly? Include ALL error messages.>

``` The south brushes exhibition

the south brushes exhibition

12.1 Simple tenses

Presente

Imperfetto

Passato remoto

Futuro

12.2 Compound tenses

Passato prossimo

Futuro anteriore

Trapassato prossimo

Trapassato remoto

12.3 Italian impersonal form

"Essere" + "aggettivo"

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

<do not remove the three backticks above>

Hey Edwinnaelbert,

Your HTML code is in a file called index.html, and this part at the very bottom of your code is in a file called myScript.js, right?

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

Yes, they are placed in different files (html and js accordingly). Sorry there are 20 days left but the topic is still important - I haven’t seen notifications on codecademy.com and I’ve found your reply in spam just now.

@edwinnaelbert OK, so I put your code in a Pen and it works:

How are you viewing the page? After you save it from Dreamweaver, if you double click on it, does it open in your browser?

Mystic. On codepen everything’s fine.



Tried to delete css file (with removing link), didn’t help.

Tried to change path of the index and js files in order to have all path in latin script. Didn’t help.

1 Like

@edwinnaelbert Oh, here’s your problem:

   6| <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script>
7-10| ...
  11| <link rel="stylesheet" href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">

Place https: before the double slashes (//) at the beginning of that URL, and it will work :slight_smile:

The reason it’s not currently is because // is a protocol-relative URL. These were a good idea several years ago, when people didn’t feel that everything needed to be on HTTPS, but now stuff has changed and it’s considered a bad practice to use these now. The way a protocol-relative URL works is, if you access the site over HTTP, it will try to fetch the resource via HTTP. If you visit via HTTPS, it will try to use HTTPS to fetch the resource. And it’s the same with any other protocol, including the one you’re using to view the HTML file here, the file protocol. The problem is, file:// is only for local files stored on your computer, and not for files on a remote server, and those two resources are on remote servers. So changing that to https:// instead should fix the problem :slight_smile:

4 Likes

Thank you a lot, zystvan, I take my hat off to you)

3 Likes

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