04-27-2017, 11:01 AM
i have added jquery in my header.php file under /usersc/includes
under this line i added a js library which depends on jquery loaded before.
the error console says "$ is not defined"
since there are 3 reasons this error could have:
so i assume:
1. it is properly loaded as i can see in network analysis in firefox debug view
2. are there some plugins which override the $ variable?
3. i think my UIlib.min.js is loaded after jquery, i see it in network analysis so jquery should be finished before my UIlib.min.js is fired. or is there any other place to put those script?
i also see jquery is loaded twice? where is it loaded it should only loaded once in the header of the page(/usersc/includes/header.php) i think.
EDIT:
if i reference it in a blank content page both jquery and my myUIlib.js there are the same errors from the header, but on the page it is working. so what is wrong with the header ? is it loaded after the page content?
Code:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
under this line i added a js library which depends on jquery loaded before.
Code:
<script type="text/javascript" src="/usersc/js/myUIlib.min.js"></script>
the error console says "$ is not defined"
since there are 3 reasons this error could have:
- 1. Your JavaScript file is not being properly loaded into your page
- 2. You have a botched version of jQuery. This could happen because someone edited the core file, or a plugin may have overwritten the $ variable.
- 3. You have JavaScript running before the page is fully loaded, and as such, before jQuery is fully loaded.
so i assume:
1. it is properly loaded as i can see in network analysis in firefox debug view
2. are there some plugins which override the $ variable?
3. i think my UIlib.min.js is loaded after jquery, i see it in network analysis so jquery should be finished before my UIlib.min.js is fired. or is there any other place to put those script?
i also see jquery is loaded twice? where is it loaded it should only loaded once in the header of the page(/usersc/includes/header.php) i think.
EDIT:
if i reference it in a blank content page both jquery and my myUIlib.js there are the same errors from the header, but on the page it is working. so what is wrong with the header ? is it loaded after the page content?