0

I'm trying to use head.js but I'm dying here to make it work. Here is my code so far:

<script type="text/javascript" src="<?php echo base_url(); ?>assets/scripts/lib/head.min.js"></script>
<script type="text/javascript">
    head.js("http://localhost/compra/assets/scripts/lib/jquery-1.6.1.min.js");
    head.ready(function ()
    {
        $('#date').datepicker();
    });
</script>

I have tried with head.ready() and without it but Google Chrome always returns this:

Uncaught TypeError: Property '$' of object [object DOMWindow] is not a function

The URL for the script file is correct.

4
  • 1
    are you actually attaching the jquery.js ? Commented Jun 13, 2011 at 16:35
  • what do you mean? I have the header.js() and the link to it, the link is correct... Commented Jun 13, 2011 at 16:43
  • Do you have anything other than head.js and jquery on the page? also if you have solved your problem please post an answer and mark it as solved. to help others who might have the same issue. Commented Jun 14, 2011 at 2:25
  • 1
    what he means is that you post your solution as an answer below and then click the checkmark to indicate that it's the solution. You are allowed to officially answer your own questions here. That way everyone reading this in the future will benefit. Commented Jun 14, 2011 at 2:35

1 Answer 1

7

I have found the solution.

I have to add

$(document).ready() right afterhead.ready(function ()

head.ready(function () {

   $(document).ready(function({
     alert('test');
   });

}

And it worked.

I don't know if that is 100% correct. It's not on the head.js website.

Hope that helps =)

PS: Really sorry for not posting the solution correctly at first time

Sign up to request clarification or add additional context in comments.

1 Comment

@AaronLee Great new! :)

Your Answer

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