John John
John John

Reputation: 1

Microsoft JScript runtime error: '$' is undefined on my Jquery function

i have the following Jquery function inside my view:-

    <script type="text/javascript">
        $(document).ready(function () {
            $("#album-list").mouseover(function () {
                $(this).animate({ height: '+=15', width: '+=15' })
.animate({ height: '-=15', width: '-=15' });
            });
        });
  </script>

i have added the following scripts to the _layout view:-

<script src="@Url.Content("~/Scripts/jquery-1.6.2.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.14.min.js")" type="text/javascript"></script>

but when i navigate to the view that contains the above Jquery function; the following error will be raised ""Microsoft JScript runtime error: '$'"". So what might be the problem? BR

Upvotes: 2

Views: 7649

Answers (2)

PriorityMark
PriorityMark

Reputation: 3247

Run fiddler and see if you're getting any 404's and make sure that your files are all actually loading. If they are, move your jQuery script include tags above the rest of your JavaScript.

Upvotes: 0

Bruno Silva
Bruno Silva

Reputation: 3097

Are you loading your scripts after your inline script? The inline script must be placed after jquery is loaded.

If that is the case, please check the location of your jquery scripts.

Upvotes: 6

Related Questions