jQuery Problem

Topics: Writing modules
Mar 28, 2011 at 8:50 PM

In my (View) module based on the Orchard Source zip download my jQuery test code snippet works; when using the exact same code snippet with the last dev branch it doesn't work: Error: "Microsoft JScript runtime error: The value of the property '$' is null or undefined, not a Function object"


<script language="javascript" type="text/javascript">
    $(document).ready(function () {
        alert('page loaded');


Mar 28, 2011 at 9:06 PM

jQuery is going to be added at the bottom of the page. Your script is going to be executed in place, so jQuery won't be available then. You need to move your script to the bottom as well:

<script type="text/javascript">
        //do stuff


Mar 28, 2011 at 9:23 PM


i see in viusal studio the page code that's generated indeed the include of jQuery is after my javascript.

I was wondering why it worked in the Orchard.Source.1.0.20 download, has something changed in the codebase why i should use now @using(Script.Foot())?

Mar 28, 2011 at 9:40 PM

I don't know. May be the theme that you're using.

Mar 29, 2011 at 7:31 PM

Indeed with Contoso theme I don't have the problem, with other words script works without @using(Script.Foot())