• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Jquery Error Code: missing "use strict" statement and expected === and saw ==

New Here ,
Dec 04, 2017 Dec 04, 2017

Copy link to clipboard

Copied

I am trying to use Jquery to create click function on a menu.

using the google cdn library.

The jQuery is not working and shows the following errors:

firstly here is the source code that shows the google library.

Screen Shot 2017-12-04 at 14.29.34.png

This is the error showing in my "scripts.js" file

Screen Shot 2017-12-04 at 14.31.02.png

And in the jQuery.min.js file this error is showing

Screen Shot 2017-12-04 at 14.32.54.png

Views

2.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 04, 2017 Dec 04, 2017

Copy link to clipboard

Copied

Ignore them, or go into preferences and turn off linting.

Dw's linting option is an all or nothing selection, and gives a number of false errors across all documents that it supports.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 04, 2017 Dec 04, 2017

Copy link to clipboard

Copied

I wouldn't worry about the so-called errors yet.

Have a look at JavaScript "use strict" and  Strict mode - JavaScript | MDN

The errors in the code do not contribute to your function(s) not working, it must be something else in your code. Without seeing your full code, I cannot help any further.

Wappler, the only real Dreamweaver alternative.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 04, 2017 Dec 04, 2017

Copy link to clipboard

Copied

well there multiple way to answer... so

1 - concerning the error... the strict use of JS is nothing else than invoquing the strict mode either from the global script either from each function

to invoque the stric usage simply add as a first line

'use strict'

you can learn more there

Strict mode - JavaScript | MDN

2 - now concerning both error 'strict' and strictly equal... concerning jquery... never mind anbd live with...

any way you can get read of those statement by going on DW preferences category Linting

select JS and then edit... you can now edit

line 21 and replace by

"strict"        :false,  

and line 6

 "eqeqeq"        : false, 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 04, 2017 Dec 04, 2017

Copy link to clipboard

Copied

and last you didn't tell us what is not working in your script...

1 - first you could send us the script and tell what's not working

2 - as you use jquery... probably you will use it in your script... so it will recommand to swap line 7 and 8... load jquery before using it

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 04, 2017 Dec 04, 2017

Copy link to clipboard

Copied

Thank you for your help; I have edited the listing as advised which has helped with the "use strict" error, but has incidentally caused many more errors in the jquery.min.js:

Screen Shot 2017-12-04 at 15.55.03.png

I have also changed the lines 7&8 over in source code.

In the browser (google chrome) preview the click function on my hamburger menu is not working, it is supposed to reveal the menu when clicked.

Source Code

Screen Shot 2017-12-04 at 15.44.45.png

Jquery (click function doesn't work in preview)

Screen Shot 2017-12-04 at 15.44.29.png

     Stylesheet showing the .expand class.

Screen Shot 2017-12-04 at 15.45.02.png

I am hoping this shows enough information.

Thank you so much for helping.

Much appreciated.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 04, 2017 Dec 04, 2017

Copy link to clipboard

Copied

In the future, never edit your jQuery library.

Replace your link to jQuery with this one hosted on the CDN.

<!--latest jQuery 3-->

<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>

Ignore all "code errors" reported in the jQuery library.  They are meaningless.

Nancy

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 04, 2017 Dec 04, 2017

Copy link to clipboard

Copied

I don't think that Alice has edited the jquery libs ? where did you see this ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 04, 2017 Dec 04, 2017

Copy link to clipboard

Copied

Ii QUOTE

"Thank you for your help; I have edited the listing as advised which has helped with the "use strict" error, but has incidentally caused many more errors in the jquery.min.js:"

That's the core jQuery Library.

Nancy

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 04, 2017 Dec 04, 2017

Copy link to clipboard

Copied

I thought that Alice had edited, as I show her, the JS linting preferences which is a listing, ... isn't it ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 04, 2017 Dec 04, 2017

Copy link to clipboard

Copied

You dont need toggleClass('expand') just toggle(); will do what you require

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 13, 2020 Sep 13, 2020

Copy link to clipboard

Copied

LATEST

problem fixed here : https://youtu.be/khmBtMlST9Q

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines