CodeIgniter Forums
simple jquery in CI - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: simple jquery in CI (/showthread.php?tid=49780)



simple jquery in CI - El Forum - 03-03-2012

[eluser]Unknown[/eluser]
Guys...i am a problem in implementing jquery in CI
i have a controller main.php as

class Main extends CI_Controller{
public function __construct()
{
parent::__construct();
}

public function index()
{
$this->load->view('page/index.php');
}
}
and view i.e page/index.php as
<html>
<head>
<link href="<?php echo base_url();?>js/jquery.js" type="text/javascript" />
<style type="text/css">
#box{
background:#F00;
height:100px;
width:100px;
}
</style>
[removed]
$(function(){ $('a').click(function(){$('#box').fadeOut('slow');
});
});

[removed]
</head>
<body>
<div id="box"></div>
<a href="#">Click here</a>
&lt;/body&gt;
&lt;/html&gt;
i have my jquery library in root jquery folder...
it doesnot show any response..help me guys plzz


simple jquery in CI - El Forum - 03-03-2012

[eluser]Peter Guest[/eluser]
Hi,

I suspect your HTML is incorrect. Try using the "script" tag instead of the "link" instead:

Cheers,
Peter


simple jquery in CI - El Forum - 03-03-2012

[eluser]josepichu[/eluser]
you must include the rel atribute into the link like this:

&lt;link rel="stylesheet" href="" /&gt;


simple jquery in CI - El Forum - 03-03-2012

[eluser]Unknown[/eluser]
[quote author="Peter Guest" date="1330779089"]Hi,

I suspect your HTML is incorrect. Try using the "script" tag instead of the "link" instead:

Cheers,
Peter[/quote]

you are absolutely right..thank u so much..Smile