Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Online demo issues #2

Open
unclehowell opened this issue Feb 21, 2021 · 1 comment
Open

Online demo issues #2

unclehowell opened this issue Feb 21, 2021 · 1 comment
Assignees

Comments

@unclehowell
Copy link
Owner

gh-pages dashboard/gui (static/gui)

Use the History API to update
the URL and make sure that reloading (F5 or Ctrl+r) brings you back to the same page.

Javascript errors. Seems like dependencies are not loaded in (in time). I often saw
"$ is not define" which looks like jQuery isn't loaded in. It also seemed that some scripts were loaded in in the while others were
loaded in .

Gamepad/Keyboard WebApp Demo (hosted)

node-gamepad websocket connection could not be established. This won't break the keyboard because it falls back to longpolling over
http but it might be worth looking into nonetheless. I suspect that apache or whatever reverse SSL proxy you used is not configured to properly forward websocket connections.

@unclehowell unclehowell self-assigned this Sep 3, 2021
@danieleverest
Copy link
Contributor

"$ is not define"

The JavaScript ReferenceError: $ is not defined occurs when the jQuery library is used but is not properly loaded or is not available in the current scope of the code.

In JavaScript, the $ symbol is often used as a shorthand alias for the jQuery library. This error indicates that the code is trying to use jQuery functionality by referencing the $ symbol, but the library is not available or has not been loaded correctly.

What Causes Javascript ReferenceError: $ is Not Defined
This error can occur for several reasons, such as:

-The jQuery library is not included in the script that references it.
-The library is included with a typo or error in the script
-The script is executed before the jQuery library is loaded, which can be caused by incorrect placement of the script tag in the HTML file.
-The code is running in a different scope or environment where the $ symbol is not defined or has a different meaning.

--ReferenceError: $ is Not Defined Example:
Here’s an example of a Javascript ReferenceError: $ is not defined thrown when jQuery is not properly loaded in a script that uses it:

<script> $(document).ready(function() { $('#myButton').click(function() { alert('Button clicked!'); }); }); </script>

In this example, the code is trying to use the jQuery library. Since jQuery is not included in the above script, running it throws the error:

*Uncaught ReferenceError: $ is not defined

How to Fix ReferenceError: $ is Not Defined

To fix the ReferenceError: $ is not defined error, jQuery should be properly loaded before any code that references it is executed. This can be done by including the library in the HTML file using a script tag, either by downloading the library and hosting it locally or by using a content delivery network (CDN) link.

Any syntax errors or typos in the script should also be checked, as they may prevent jQuery from loading correctly.

The earlier example can be updated to fix the error by using the above approach:

<title>Example</title> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> Click me <script> $(document).ready(function() { $('#myButton').click(function() { alert('Button clicked!'); }); }); </script>

Here, the jQuery library is included using a script tag with a CDN link. This makes it available to be used in the script, which avoids the ReferenceError: $ is not defined error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants