jQuery in script tags and using $(document).ready() throughout the a page
December 10, 2015 at 8:52 pmPosts: 7Member Reply #4032
First off I want to say that I love Metronic so far and after some tinkering I have been able to get most of it working with the codeigniter php framework as the back end.
The problem I’m having probably has to do with the order/placement of loading the js script files but I can’t seem to find the correct order.
If I place the following code on the page I get $ is not defined(or jQuery is not defined if I replace $ with jQuery):
How am I supposed to work around this or what do you recommend? I would like to be able to include quick scripts on pages without having to load another/custom js file at the bottom of the page and have to use the init() setup you have in place. If it helps I could privately provide you with a link to my test site.
December 10, 2015 at 9:27 pmPosts: 7Member Reply #4033
December 15, 2015 at 5:59 pmPosts: 4527Support Staff Reply #4079
Great! Glad to managed to fix it. If you need any further assistance please let us know.
December 15, 2015 at 6:14 pmPosts: 7Member Reply #4084
No my 2nd post was correcting my first post since I couldn’t edit it. I still have the same problem, can you please help?
December 17, 2015 at 3:34 amPosts: 4527Support Staff Reply #4101
Please make sure jquery library is properly loaded in your page. It seems jquery is not being loaded and you are getting ‘jquery undefined’ error. If you need any further assistance please let us know which Metronic version you are using and if possible provide a test link to your developing site in a private reply. If you can’t provide us any test link then try to double check the HTML template and compare it with the original one to make sure all dependency js and css files are fully loaded.
To go further you can use Chrome’s dev tools(CTRL+SHIFT+J) to debug your page and detect possible errors and issue from your page.
December 22, 2015 at 6:19 pmPosts: 7Member Reply #4200
I found a fix for my issue here
This allows me to load jquery.min.js after the </body> tag AND I can use $(document).ready() anywhere on the page without error which was my problem.
You must be logged in to reply to this topic.