CodeIgniter Forums
where to write JS code - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: where to write JS code (/thread-11708.html)



where to write JS code - El Forum - 09-20-2008

[eluser]Mitja B.[/eluser]
What you suggest where to write JS code.

The code like this

Code:
[removed]
$(function(){
    $("form input[@type='text']").addClass("input");
    
    $(".date-pick").css("width", "100px");
    $("input[@name='duration_in_hour'], input[@name='number_of'], input[@name='price_eur'], input[@name='price_eur_simobil']").css("width", "70px");
});
[removed]

to write it in view file or in controller file.

If in controler where

Code:
function content_add()
{
...

$this->load->view('admin/content_add', $data);    
}


thx


where to write JS code - El Forum - 09-20-2008

[eluser]manilodisan[/eluser]
Why should you use PHP to load js?


where to write JS code - El Forum - 09-20-2008

[eluser]Mitja B.[/eluser]
i can load it in .html too. But i load page with view. How can i load js then?


where to write JS code - El Forum - 09-20-2008

[eluser]manilodisan[/eluser]
By placing the normal js link in the view?!