I am trying to include jquery in my codeigniter application. To do this, I created a js folder inside the codeigniter folder, where I put two files. Jquery.js with code to run jquery and another duplicate.js file where I have the following code to see if the jquery page is running.
window.onload = function() { if (window.jQuery) { // jQuery is loaded alert("Yeahsssss!"); } else { // jQuery is not loaded alert("Doesn't Work"); } }
Then in the headr template of my views, I have:
<html> <head> <title></title> <meta http-equiv="content-type" content="text/html;charset=UTF-8"> <link rel="stylesheet" href="<?php echo base_url();?>css/mystyle.css" type="text/css" media="screen"/> <script type="text/javasript" src="<?=base_url()?>js/jquery.js"></script> <script type="text/javasript" src="<?=base_url()?>js/duplicate.js"></script> </head> <body>
Should this not be enough to run jquery on pages? Did I miss something?
EDIT:
head section generated:
<head> <title> - CodeIgniter 2 Tutorial</title> <meta http-equiv="content-type" content="text/html;charset=UTF-8"> <link rel="stylesheet" href="http://localhost/code/css/mystyle.css" type="text/css" media="screen"/> <script type="text/javasript" src="http://localhost/code/js/jquery.js"></script> <script type="text/javasript" src="http://localhost/code/js/duplicate.js"></script> </head>
source share