Javascript Runtime error: $ is undefined

后端 未结 5 1746
耶瑟儿~
耶瑟儿~ 2020-12-09 13:16

I have added script in my Default.aspx page. I am getting following error. \"Error\"

相关标签:
5条回答
  • 2020-12-09 13:32

    $ is defined by jQuery, which you probably haven't referenced. A simple way to get it is to add one of the CDN urls to your template HTML:

    <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
    
    0 讨论(0)
  • 2020-12-09 13:34

    You need to include jQuery: http://learn.jquery.com/about-jquery/how-jquery-works/

    <!doctype html>
    <html>
    <head>
        <meta charset="utf-8" />
        <title>Demo</title>
        **<script src="jquery.js"></script>**
    </head>
    <body>
      ...
    </body>
    </html>
    
    0 讨论(0)
  • 2020-12-09 13:51

    (For others who may face the same problem as OP's)
    I had the same problem, but the reason was that I was trying to load my jQuery script before loading the jQuery library itself. In other words, make sure that you first add this line:

    <script src="Scripts/jquery-{version}.min.js"></script>
    

    before adding

    <script src="Scripts/JavaSript_scroll.js"></script>
    
    0 讨论(0)
  • 2020-12-09 13:54

    I had the same problem, but did have a correct reference to jQuery.

    I solved it by referencing jQuery before any other scripts. In your case, it would look like this:

    <script src= "scripts/jquery-ui.js" />
    <script src= "scripts/JavaScript_scroll.js" />
    

    Hope this helps anyone else with a similar issue.

    0 讨论(0)
  • 2020-12-09 13:57

    I had the Same Problem as that $ is Unidentified, After a long struggle, I come to know that there is some thing HTML coder error in Master Page, So it worked fine when i include the Jquery files directly in Content pageenter image description here

    0 讨论(0)
提交回复
热议问题