Sunday, February 12, 2012

<script type=&hellip;></script> works but javascript_include_tag doesn"t


I put jquery.validate.js in my public/javascript folder and I called




<%= javascript_include_tag 'jquery.validate' %>



in the header but I get this in the chrome debugger:




Uncaught TypeError: Object [object Object] has no method 'validate'



I can see jquery.validate.js?1317943298 under javascripts/ in the chrome debugger.



On the other hand, when I add this right before I call validate(),




<script type="text/javascript" src="http://jzaefferer.github.com/jquery-validation/jquery.validate.js"></script>



it works. I see jquery.validate.js under jquery-validation/ as well as jquery.validate.js?1317943298 under javascripts/ in the chrome debugger. Both files are identical.



What's going on here?

1 comment:

  1. When you use the server side script it is getting an error on the server side trying to find the jquery object. I don't think you gave us enough information to get any more detailed of an answer.

    What is wrong with using the tag?

    ReplyDelete