JQuery - Microsoft JScript Runtime Error: Expected Object

Below is the contents of my .aspx page, and "jquery-ui-1.7.1.custom.min.js" is in the same place as the .aspx file. When I launch the website with debugging, I get the following error. I know something terribly missing here. Any clue?

Error: -

Microsoft JScript runtime error: Object expected

When I run without debugging, I get the following javascript error: -

Line: 10
Error: 'jQuery' is undefined

ASPX Page Content: -

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="jquery-ui-1.7.1.custom.min.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <script>$(function () { alert('hello') });</script> 

    </div>
    </form>
</body>
</html>
+3
source share
2 answers

jQuery UI is not inlucde base jQuery. You need to import this before UI-js.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

.. Fredrick

+11
source

to fix this error we need to add jquery library refernce

0

Source: https://habr.com/ru/post/1752632/


All Articles