Search code examples
jquerycodeignitercodeigniter-2

codeigniter jquery not working


I have included files in codeigniter webpage like this:

<link rel="stylesheet" type="text/css" href='<?= base_url() ?>css/unofficialchannels/style.css' />
<script type="text/javascript" src='<?= base_url() ?>js/jquery-1.8.2.min.js'></script>
<script type="text/javascript" src='<?= base_url() ?>js/jquery.tweetable.js'></script>
<script type="text/javascript" src='<?= base_url() ?>js/javascript.js'></script>

I have a function in javascript.js file like this:

$(function () {
  alert('It works!');
}); 

I also tried a function like this:

$(document).ready(function(){
    alert('It works!');
});

But it doesn't work, i don't get alert. Anybody has any ideas?


Solution

  • OK, it works now. I had some king of a problem with jquery file. I downloaded it from jquery.com and uploaded it again. It works ok now.