C# ASP.NET SQL SERVER

Microsoft JScript runtime error object expected with jQuery

I was trying to get a simple piece of jQuery to work and was running up against this error in Internet Explorer (IE):

Microsoft JScript runtime error: object expected

The problem turned out to be that I wasn't referencing jQuery to the correct path. The trick I discovered, if you're using Visual Studio, is to just drag the JavaScript file from the Solution Explorer into the <head> element on your page and it will insert the correct reference for you.

UPDATE (9 July 2009):

I am referencing jQuery from the Google CDN now:

<script src="http://www.google.com/jsapi"></script>
    <script>
        google.load("jquery", "1.3.2");
        google.load("jqueryui", "1.7.2");
</script>

Using this technique will also get rid of this error and improve performance.

» Similar Posts

  1. AZGroups Forward/Back Button History and jQuery
  2. ASP.NET MVC with jQuery DynaTree plugin for Checkboxes
  3. Combine, compress, and update your CSS file in ASP.NET MVC

» Trackbacks & Pingbacks

    No trackbacks yet.
Trackback link for this post:
http://guyellisrocks.com/trackback.ashx?id=121

» Comments

  1. amjad khan avatar

    make sure the script tag in the head tag that references jquery ends with '</script>' and not '/>'. the same as dragging the script file onto your markup

    THX

    amjad khan — July 9, 2009 11:15 AM
  2. Howie M avatar

    Search the problem , your page came up.

    Worked for me ... thank you.

    Howie M — August 8, 2009 10:46 AM
  3. Intekhab avatar

    Thanks Amjad and Ellis, found you after breaking my head for nearly 10 hours on this error and your solution worked. You guys rock!!!!!

    Intekhab — October 20, 2009 11:22 AM
  4. Ranjit Kumar avatar

    Amjed, half a day of my precious life already had gone down the drain trying to get Jquery to work in a dummy Asp.net web app. Your information saved further time being lost, much appreciate it.

    Ellis, thanks for sharing info on using declarative syntax to refer to a particular version of jquery.

    Ranjit Kumar — October 23, 2009 1:56 PM
  5. Pradeep avatar

    Good Information, saved my time.

    Thanks Amjed and ellis.

    Pradeep — December 28, 2009 5:36 AM
  6. Joe avatar

    Worked for me! Thanks very much

    Joe — January 25, 2010 12:13 PM
  7. Pat avatar

    I spent so much time trying to 'debug' this and with a simple drag and drop, my link now works!

    Pat — March 30, 2010 4:17 PM
  8. Don S avatar

    You hit the error eactly. It hlped me a lot. thanks

    Don S — June 13, 2010 10:52 PM

» Leave a Comment