Welcome Guest, Not a member yet? Register   Sign In
Uncaught ReferenceError: $ is not defined - Datepicker - Codeigniter 3
#5
Thumbs Up 

(04-18-2019, 10:23 AM)dave friend Wrote: One problem might be the use of the "defer" attribute with the <script> elements. This means that jQuery won't load until after all the other html loads.

But this bit of code will try run as soon as the view is loaded.  
Code:
$( "#datepicker" ).datepicker({inline: true});
Of course, it fails - jQuery hasn't loaded yet so $ is not defined.

Remove the defer attr from the <script> tags and see if that helps.

You might get new errors that we can address later.

Hello Guys, Thank you so much for your tipps, help and attention.

I think, until today i have made this wrong even that i've already read the whole C.I documentation.

There is a compatibility between those links format:
Code:
<?php echo base_url(); ?>assets/lib/jquery-3.3.1.min.js"


And this link format:
Code:
<?php echo base_url("assets/lib/jquery-3.3.1.min.js"); ?>"


The documentation says openly so, use the base_url like this:

1° echo base_url("blog/post/123");

2° echo base_url("images/icons/edit.png");

https://www.codeigniter.com/user_guide/h...l#base_url

base_url with controllername, method and parameter INSIDE the (parentheses) and NOT OUTSIDE.

But, definitivily i removed the "defer" attr from the <script> tags and it runs!.

Thank you so much everyone, in special @Dave_Friend Idea It works without any error.
Reply


Messages In This Thread
RE: Uncaught ReferenceError: $ is not defined - Datepicker - Codeigniter 3 - by Porto - 04-23-2019, 05:08 AM



Theme © iAndrew 2016 - Forum software by © MyBB