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

Hello Guys, Greetings!

First of all, thank you so much for the help!

Scenario:

1° I use codeigniter

2° I added this very simple script in my VIEW FILE.
(https://jqueryui.com/datepicker/#default)

3° This is the error message that i receive in the browser:
Code:
Uncaught ReferenceError: $ is not defined at VM113 info:21
(anonymous) @ VM113 info:21

This my controller method:



Code:
public function info()
{
   $data['pagetitle'] = 'general use';

   $this->load->view('theme/header1');
   $this->load->view('multiform/register2',$data);
   $this->load->view('theme/footer');
}


This my Header VIEW file: header1



Code:
<!DOCTYPE html>
<html lang="en">
<head>  
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>Teste</title>

<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>assets/testelib/jquery-ui.min.css">  

<script type="text/javascript" defer src="<?php echo base_url(); ?>assets/testelib/jquery-3.3.1.min.js"></script>

<script type="text/javascript" defer src="<?php echo base_url(); ?>assets/testelib/jquery-ui.js"></script>

<script>

   $( "#datepicker" ).datepicker({
   inline: true
   });
</script>

This my VIEW file: register2


Code:
<p>Date: <input type="text" id="datepicker"></p>

PS: If i try this example with "all files in the same folder", the script works normally.

Just because the .js and .css Links of the Jquery Libraries are in separeted files, i got this conflict.

What should i do please?

Is that even possible to call the Jquery Script when the HTML-Attributenode is in another file??

Jquery Script - Header File
Code:
<script>

   $( "#datepicker" ).datepicker({
   inline: true
   });
</script>

HTML-Attributenode - VIEW File

Code:
<p>Date: <input type="text" id="datepicker"></p>


I would be MEGA Thanksful if someone can help me with it.
Reply


Messages In This Thread
Uncaught ReferenceError: $ is not defined - Datepicker - Codeigniter 3 - by Porto - 04-18-2019, 02:28 AM



Theme © iAndrew 2016 - Forum software by © MyBB