The following warnings occurred: | ||||||||||||
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
|
initialize jquery with some js which require jquery - Printable Version +- UserSpice (https://userspice.com/forums) +-- Forum: Support Center (https://userspice.com/forums/forumdisplay.php?fid=23) +--- Forum: UserSpice 4.3 and Below (https://userspice.com/forums/forumdisplay.php?fid=26) +--- Thread: initialize jquery with some js which require jquery (/showthread.php?tid=544) |
initialize jquery with some js which require jquery - chwzr - 04-27-2017 i have added jquery in my header.php file under /usersc/includes 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:
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? initialize jquery with some js which require jquery - chwzr - 04-27-2017 when i put the two lines in the /user/includes/header.php it is working without error. no clue why.. but it works. initialize jquery with some js which require jquery - mudmin - 04-27-2017 Can you paste your header.php to pastebin or hastebin and share the link so I can see what's going on? I'm not a javascript guy (I'm learning), so there's a good chance I goofed something with jQ. |