[eluser]j4zzyh4ck3r[/eluser]
I have this code
Code:
class Javascript extends CI_Controller {
private $_data;
public function __construct() {
parent::__construct();
$this->load->helper(array('url'));
$this->load->library(array('javascript'));
// $this->load->library(array('javascript', array(
// 'js_library_driver' => 'scripto',
// 'autoload' => FALSE
// )));
$this->jquery->script(base_url() . 'assets/libraries/jquery/jquery-1.5.2.min.js', TRUE);
$this->javascript->output(
$this->javascript->ready(
$this->javascript->click('#my-div',
$this->javascript->hide('#my-div', 1000)
)
)
);
$this->javascript->compile();
}
public function index() {
$this->load->view('javascript_view');
}
}
Why in the view source is like this...
Code:
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>::[removed]:</title>
[removed][removed]
[removed][removed]
[removed]
// <![CDATA[
$(document).ready(function() {
$("#my-div").click(function(){
$("#my-div").hide(1000);
return false;
});
$("#my-div").click(function(){
$("#my-div").hide(1000);
return false;
});
});
// ]]>
[removed]
</head>
<body>
<div id="my-div"><h1>Hello World</h1></div>
</body>
</html>
The script call twice, it happens when I added jquery event...