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

Cannot get JS to work on my webpage.

Community Beginner ,
Aug 31, 2017 Aug 31, 2017

Hello,

I'm trying to get an external JS sheet on my webpage to actually do what I want it to do and it's as if it just ignores it.

1) I've attached the JS sheet to the <head> section and using the full link of the following

<script type="text/javascript" src="../JS Documents/bookCastingJS.js"></script>

<script src="https://code.jquery.com/jquery-1.11.0.min.js"></script>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

Doesn't work, so I used single commas instead of the default double quotation marks, & shock horror, still doesn't work. Is it just me or is this he most ridiculous programme I've ever worked with? Why am I coding exactly from a tutorial on Stack Overflow which works on perfectly, but it doesn't bother work on DW?

2) Giving up on that, I decided to put the JS code into the HTML webpage under the <script> tags & would you believe it, still doesn't want to play ball.

Its a computer programme, its not a disobedient child. If it works in one programme I expect it to work in any other programme I use. I should not have to waste my time on these forums asking for help just because my JS file can't be bothered to work on DW.

I use Edge as a browser by the way.

Any valid reason as to why this might be?

1.1K
Translate
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

correct answers 1 Correct answer

Community Expert , Aug 31, 2017 Aug 31, 2017

If <script type="text/javascript" src="../JS Documents/bookCastingJS.js"></script> is dependant on the jQuery library, then jQuery should be loaded first.

You have called three different jQuery libraries, namely

<script src="https://code.jquery.com/jquery-1.11.0.min.js"></script>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

That is enough to conf

...
Translate
Community Expert ,
Aug 31, 2017 Aug 31, 2017

If <script type="text/javascript" src="../JS Documents/bookCastingJS.js"></script> is dependant on the jQuery library, then jQuery should be loaded first.

You have called three different jQuery libraries, namely

<script src="https://code.jquery.com/jquery-1.11.0.min.js"></script>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

That is enough to confuse anyone let alone a poor computer. Remove two of those libraries.

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
Translate
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 ,
Aug 31, 2017 Aug 31, 2017

What Ben said is absolutely correct.  The order in which scripts load is very important.  Never use more than 1 jQuery core library.

To add one more thing,  jQuery 3.x is the very latest stable release however it might be too advanced for older plugins.  An old plugin might work better with jQuery 2.x or 1.x.

See jQuery CDN

Nancy

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
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 ,
Aug 31, 2017 Aug 31, 2017
LATEST

You should also place the bookCastingjs file after the jQuery file, if it is written in jQuery.

If your browser downloads or executes that file, before the jQuery file is downloaded and executed the browser will throw errors on the bookCasting code. You can easily check if this is the reason, or if it is a coding problem by using the dev console in Edge, to checking the network loading sequence for file loading and using the de-bugger for coding errors.

Translate
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