0

I am using code igniter, and I want to add a datetime picker using datetimepicker. The script can be found here

I have 2 sections on my webpage - the header and the content. On the controller, I load them both. Here is my javascript head

<script href="<?php echo base_url(); ?>js/datetimepicker.js" type="text/javascript"></script>

and here is my textbox code <input id="tanggal" type="text" class="textbox" disabled="disabled"> <a href="javascript:NewCal('tanggal','ddmmyyyy')"><img src="<?php base_url(); ?>img/cal.gif"></a>

when I refresh the page, I can hover the cal.gif, but when I click em, cal.gif is not responding. What went wrong in my code?

2 Answers 2

2

This is not the correct way of including javascript files:

<script href="<?php echo base_url(); ?>js/datetimepicker.js" type="text/javascript"></script>

It should be:

<script src="<?php echo base_url(); ?>js/datetimepicker.js" type="text/javascript"></script>
0
0

Just to keep in mind, base_url allows to do this:

<script src="<?php echo base_url('js/datetimepicker.js')?>" type="text/javascript"></script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.