Welcome Guest, Not a member yet? Register   Sign In
Javascript !!

Hi guys,

can you please tell me how can i implement javascript in my view?

below is the self defined function to check users information in javascript that i want to implement in CI...

if (document.forms[0].eu_address.value.length ==0){
alert('Please enter the End User Address.')
return false}
if (document.forms[0].eu_city.value.length ==0){
alert('Please enter the End User City.')
return false}

You can implement the js code in your view into

<scipt type='text/javascript'></scipt>
Or you can write your code into a seperate js file, like mycode.js and create for example the below file stracture:

|-- assets
    |-- js
|-- system
|-- index.php

and call it in your view with
<scipt type = 'text/javascript' src = '&lt;?php echo base_url(); ?&gt;/assets/js/mycode.js'></scipt>

P.S. I write above scipt instead script because for security reasons, forum remove the script tags.

Theme © iAndrew 2016 - Forum software by © MyBB