Welcome Guest, Not a member yet? Register   Sign In
jQuery
#4

[eluser]eokorie[/eluser]
Hi

Try this:

Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');



class Javascript_test extends CI_Controller
{

    function __construct()
    {
        parent::__construct();
        $this->load->library('javascript');
        $this->load->library('jquery', FALSE);
    }

    function index() {
        $data = array();

        $this->jquery->script('/assets/js/jquery/jquery.js', TRUE);
        $js = $this->javascript->hide('#myDiv');

        $this->javascript->output($js);
        $this->javascript->compile();

        $this->load->view('index',$data);

    }

}

Your html would the look like this:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
&lt;html &gt;
&lt;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/&gt;
    &lt;title&gt;Javascript Test&lt;/title&gt;
    &lt;?php echo isset($script_head) ? $script_head : ''; ?&gt;
&lt;/head&gt;
&lt;body&gt;
<div id="myDiv">
    This is my div!
</div>
&lt;?php echo isset($library_src) ? $library_src : ''; ?&gt;
&lt;?php echo isset($script_foot) ? $script_foot : ''; ?&gt;
&lt;/body&gt;
&lt;/html&gt;

Hope this helps!


Messages In This Thread
jQuery - by El Forum - 02-15-2011, 07:35 AM
jQuery - by El Forum - 02-15-2011, 07:49 AM
jQuery - by El Forum - 02-15-2011, 10:25 AM
jQuery - by El Forum - 02-15-2011, 03:54 PM
jQuery - by El Forum - 02-15-2011, 07:00 PM
jQuery - by El Forum - 02-15-2011, 08:03 PM
jQuery - by El Forum - 02-15-2011, 08:04 PM
jQuery - by El Forum - 02-15-2011, 08:22 PM



Theme © iAndrew 2016 - Forum software by © MyBB